-
-
Notifications
You must be signed in to change notification settings - Fork 773
Closed
Description
This code is pretty messy:
Lines 245 to 265 in 0abd3ab
if shape == 'object': | |
error = None | |
if 'primary_keys' not in data: | |
error = '_shape=object is only available on tables' | |
else: | |
pks = data['primary_keys'] | |
if not pks: | |
error = '_shape=object not available for tables with no primary keys' | |
else: | |
object_rows = {} | |
for row in data['rows']: | |
pk_string = path_from_row_pks(row, pks, not pks) | |
object_rows[pk_string] = row | |
data['rows'] = object_rows | |
if error: | |
data = { | |
'ok': False, | |
'error': error, | |
'database': name, | |
'database_hash': hash, | |
} |
Instead, it would be nice if I could raise an exception that would be converted into the appropriate JSON or HTML error message, with a corresponding HTTP code.
Metadata
Metadata
Assignees
Labels
No labels