Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/validate.py
Show All 24 Lines | |||||
@contextlib.contextmanager | @contextlib.contextmanager | ||||
def convert_validation_exceptions(): | def convert_validation_exceptions(): | ||||
"""Catches validation errors arguments, and re-raises a | """Catches validation errors arguments, and re-raises a | ||||
StorageArgumentException.""" | StorageArgumentException.""" | ||||
try: | try: | ||||
yield | yield | ||||
except VALIDATION_EXCEPTIONS as e: | except VALIDATION_EXCEPTIONS as e: | ||||
raise StorageArgumentException(*e.args) | raise StorageArgumentException(str(e)) | ||||
class ValidatingProxyStorage: | class ValidatingProxyStorage: | ||||
"""Storage implementation converts dictionaries to swh-model objects | """Storage implementation converts dictionaries to swh-model objects | ||||
before calling its backend, and back to dicts before returning results | before calling its backend, and back to dicts before returning results | ||||
""" | """ | ||||
def __init__(self, storage): | def __init__(self, storage): | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |