Skip to content

Commit

Permalink
fix(logic): syntax;
Browse files Browse the repository at this point in the history
- Pythonian stuffs.
  • Loading branch information
JVickery-TBS committed Dec 16, 2024
1 parent a72c1a9 commit 527f3be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ckanext/recombinant/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,15 @@ def recombinant_datastore_upsert(up_func, context, data_dict):
Wraps datastore_upsert action to split Validation Errors with format_trigger_error.
"""
try:
up_func(context, data_dict)
return up_func(context, data_dict)
except ValidationError as e:
_error_dict = dict(e.error_dict)
_error_dict['records'] = dict(_error_dict['records'])
if 'records' not in _error_dict:
raise
_error_dict['records'] = list(_error_dict['records'])
for record_errs in _error_dict['records']:
if not isinstance(record_errs, dict):
continue
for field, field_errs in record_errs.items():
record_errs[field] = list(format_trigger_error(field_errs))
raise ValidationError(_error_dict)

0 comments on commit 527f3be

Please sign in to comment.