From b2cd7704ddb82695c1f50de7bd481d77128bfa72 Mon Sep 17 00:00:00 2001 From: amercader Date: Wed, 30 Oct 2024 13:12:14 +0100 Subject: [PATCH] Check if extras exist before converting In some situations like when validating an already validated dataset we might be missing the `extras` key. See https://github.com/ckan/ckanext-dcat/issues/305 https://github.com/ckan/ckan/pull/7571 --- ckanext/scheming/plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/scheming/plugins.py b/ckanext/scheming/plugins.py index 0980a684..67c2e8fa 100644 --- a/ckanext/scheming/plugins.py +++ b/ckanext/scheming/plugins.py @@ -279,7 +279,7 @@ def composite_convert_to(key, data, errors, context): del data[(f,)] if action_type == 'show': - if composite_convert_fields: + if composite_convert_fields and data_dict.get("extras"): for ex in data_dict['extras']: if ex['key'] in composite_convert_fields: data_dict[ex['key']] = json.loads(ex['value'])