def __validate_data(data): if not isinstance(data.get('ExamplePropertyA', None), string_types): raise errors.HandledError('Property ExamplePropertyA in provided data is missing or is not a string.') if not isinstance(data.get('ExamplePropertyB', None), int): raise errors.HandledError('Property ExamplePropertyB in provided data is missing or is not an integer.')
def update(request, key, data): __validate_data(data) if not table_data.update(key, data): raise errors.HandledError('No data with key {} was found.'.format(key))
def delete(request, key): if not table_data.delete(key): raise errors.HandledError('No data with key {} was found.'.format(key))
def read(request, key): data = table_data.read(key) if data is None: raise errors.HandledError('No data with key {} was found.'.format(key)) return data