Revision 7efc9f86 snf-pithos-backend/pithos/backends/base.py

b/snf-pithos-backend/pithos/backends/base.py
42 42
class QuotaError(Exception):
43 43
    pass
44 44

  
45
class AccountExists(NameError):
46
    pass
47
    
48
class ContainerExists(NameError):
49
    pass
50

  
51
class AccountNotEmpty(IndexError):
52
    pass
53

  
54
class ContainerNotEmpty(IndexError):
55
    pass
56

  
57
class ItemNotExists(NameError):
58
    pass
59

  
60
class VersionNotExists(IndexError):
61
    pass
62

  
45 63
class BaseBackend(object):
46 64
    """Abstract backend class that serves as a reference for actual implementations.
47 65
    
......
165 183
        Raises:
166 184
            NotAllowedError: Operation not permitted
167 185
            
168
            IndexError: Account is not empty
186
            AccountNotEmpty: Account is not empty
169 187
        """
170 188
        return
171 189
    
......
193 211
        Raises:
194 212
            NotAllowedError: Operation not permitted
195 213
            
196
            NameError: Container does not exist
214
            ItemNotExists: Container does not exist
197 215
        """
198 216
        return []
199 217
    
......
214 232
        Raises:
215 233
            NotAllowedError: Operation not permitted
216 234
            
217
            NameError: Container does not exist
235
            ItemNotExists: Container does not exist
218 236
        """
219 237
        return {}
220 238
    
......
231 249
        Raises:
232 250
            NotAllowedError: Operation not permitted
233 251
            
234
            NameError: Container does not exist
252
            ItemNotExists: Container does not exist
235 253
        """
236 254
        return
237 255
    
......
246 264
        Raises:
247 265
            NotAllowedError: Operation not permitted
248 266
            
249
            NameError: Container does not exist
267
            ItemNotExists: Container does not exist
250 268
        """
251 269
        return {}
252 270
    
......
256 274
        Raises:
257 275
            NotAllowedError: Operation not permitted
258 276
            
259
            NameError: Container does not exist
277
            ItemNotExists: Container does not exist
260 278
            
261 279
            ValueError: Invalid policy defined
262 280
        """
......
268 286
        Raises:
269 287
            NotAllowedError: Operation not permitted
270 288
            
271
            NameError: Container already exists
289
            ContainerExists: Container already exists
272 290
            
273 291
            ValueError: Invalid policy defined
274 292
        """
......
280 298
        Raises:
281 299
            NotAllowedError: Operation not permitted
282 300
            
283
            NameError: Container does not exist
301
            ItemNotExists: Container does not exist
284 302
            
285
            IndexError: Container is not empty
303
            ContainerNotEmpty: Container is not empty
286 304
        """
287 305
        return
288 306
    
......
321 339
        Raises:
322 340
            NotAllowedError: Operation not permitted
323 341
            
324
            NameError: Container does not exist
342
            ItemNotExists: Container does not exist
325 343
        """
326 344
        return []
327 345
    
......
334 352
        Raises:
335 353
            NotAllowedError: Operation not permitted
336 354
            
337
            NameError: Container does not exist
355
            ItemNotExists: Container does not exist
338 356
        """
339 357
        return []
340 358
    
......
377 395
        Raises:
378 396
            NotAllowedError: Operation not permitted
379 397
            
380
            NameError: Container/object does not exist
398
            ItemNotExists: Container/object does not exist
381 399
            
382
            IndexError: Version does not exist
400
            VersionNotExists: Version does not exist
383 401
        """
384 402
        return {}
385 403
    
......
396 414
        Raises:
397 415
            NotAllowedError: Operation not permitted
398 416
            
399
            NameError: Container/object does not exist
417
            ItemNotExists: Container/object does not exist
400 418
        """
401 419
        return ''
402 420
    
......
413 431
        Raises:
414 432
            NotAllowedError: Operation not permitted
415 433
            
416
            NameError: Container/object does not exist
434
            ItemNotExists: Container/object does not exist
417 435
        """
418 436
        return {}
419 437
    
......
426 444
        Raises:
427 445
            NotAllowedError: Operation not permitted
428 446
            
429
            NameError: Container/object does not exist
447
            ItemNotExists: Container/object does not exist
430 448
            
431 449
            ValueError: Invalid users/groups in permissions
432 450
        """
......
438 456
        Raises:
439 457
            NotAllowedError: Operation not permitted
440 458
            
441
            NameError: Container/object does not exist
459
            ItemNotExists: Container/object does not exist
442 460
        """
443 461
        return None
444 462
    
......
451 469
        Raises:
452 470
            NotAllowedError: Operation not permitted
453 471
            
454
            NameError: Container/object does not exist
472
            ItemNotExists: Container/object does not exist
455 473
        """
456 474
        return
457 475
    
......
461 479
        Raises:
462 480
            NotAllowedError: Operation not permitted
463 481
            
464
            NameError: Container/object does not exist
482
            ItemNotExists: Container/object does not exist
465 483
            
466
            IndexError: Version does not exist
484
            VersionNotExists: Version does not exist
467 485
        """
468 486
        return 0, []
469 487
    
......
482 500
        Raises:
483 501
            NotAllowedError: Operation not permitted
484 502
            
485
            NameError: Container does not exist
503
            ItemNotExists: Container does not exist
486 504
            
487 505
            ValueError: Invalid users/groups in permissions
488 506
            
......
513 531
        Raises:
514 532
            NotAllowedError: Operation not permitted
515 533
            
516
            NameError: Container/object does not exist
534
            ItemNotExists: Container/object does not exist
517 535
            
518
            IndexError: Version does not exist
536
            VersionNotExists: Version does not exist
519 537
            
520 538
            ValueError: Invalid users/groups in permissions
521 539
            
......
540 558
        Raises:
541 559
            NotAllowedError: Operation not permitted
542 560
            
543
            NameError: Container/object does not exist
561
            ItemNotExists: Container/object does not exist
544 562
            
545 563
            ValueError: Invalid users/groups in permissions
546 564
            
......
557 575
        Raises:
558 576
            NotAllowedError: Operation not permitted
559 577
            
560
            NameError: Container/object does not exist
578
            ItemNotExists: Container/object does not exist
561 579
        """
562 580
        return
563 581
    
......
593 611
        """Return a block's data.
594 612
        
595 613
        Raises:
596
            NameError: Block does not exist
614
            ItemNotExists: Block does not exist
597 615
        """
598 616
        return ''
599 617
    

Also available in: Unified diff