From 527f3beb8dd8acca6b2b74d05de794ec7bd67598 Mon Sep 17 00:00:00 2001 From: Jesse Vickery Date: Mon, 16 Dec 2024 20:22:34 +0000 Subject: [PATCH] fix(logic): syntax; - Pythonian stuffs. --- ckanext/recombinant/logic.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ckanext/recombinant/logic.py b/ckanext/recombinant/logic.py index c218d1e..294776c 100644 --- a/ckanext/recombinant/logic.py +++ b/ckanext/recombinant/logic.py @@ -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)