Revision 7efc9f86 snf-pithos-app/pithos/api/util.py
b/snf-pithos-app/pithos/api/util.py | ||
---|---|---|
64 | 64 |
SERVICE_TOKEN, COOKIE_NAME) |
65 | 65 |
|
66 | 66 |
from pithos.backends import connect_backend |
67 |
from pithos.backends.base import NotAllowedError, QuotaError |
|
67 |
from pithos.backends.base import NotAllowedError, QuotaError, ItemNotExists, VersionNotExists
|
|
68 | 68 |
|
69 | 69 |
import logging |
70 | 70 |
import re |
... | ... | |
340 | 340 |
content_type, 'pithos', meta, False, permissions, src_version, delimiter) |
341 | 341 |
except NotAllowedError: |
342 | 342 |
raise Forbidden('Not allowed') |
343 |
except (NameError, IndexError):
|
|
343 |
except (ItemNotExists, VersionNotExists):
|
|
344 | 344 |
raise ItemNotFound('Container or object does not exist') |
345 | 345 |
except ValueError: |
346 | 346 |
raise BadRequest('Invalid sharing header') |
... | ... | |
351 | 351 |
request.backend.update_object_public(request.user_uniq, dest_account, dest_container, dest_name, public) |
352 | 352 |
except NotAllowedError: |
353 | 353 |
raise Forbidden('Not allowed') |
354 |
except NameError:
|
|
354 |
except ItemNotExists:
|
|
355 | 355 |
raise ItemNotFound('Object does not exist') |
356 | 356 |
return version_id |
357 | 357 |
|
... | ... | |
662 | 662 |
self.block_hash = self.hashmaps[self.file_index][self.block_index] |
663 | 663 |
try: |
664 | 664 |
self.block = self.backend.get_block(self.block_hash) |
665 |
except NameError:
|
|
665 |
except ItemNotExists:
|
|
666 | 666 |
raise ItemNotFound('Block does not exist') |
667 | 667 |
|
668 | 668 |
# Get the data from the block. |
Also available in: Unified diff