Skip to content

Commit

Permalink
[#56] Handle list values
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed May 8, 2024
1 parent 65abb1f commit 9faf5f5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ckanext/dcat/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,13 @@ def _set_dataset_value(self, dataset_dict, key, value):

return dataset_dict

def _set_list_dataset_value(self, dataset_dict, key, value):
schema_field = self._schema_field(key)
if schema_field and 'scheming_multiple_text' in schema_field['validators']:
return self._set_dataset_value(dataset_dict, key, value)
else:
return self._set_dataset_value(dataset_dict, key, json.dumps(value))

def _get_dataset_value(self, dataset_dict, key, default=None):
'''
Returns the value for the given key on a CKAN dict
Expand Down Expand Up @@ -1094,8 +1101,7 @@ def parse_dataset(self, dataset_dict, dataset_ref):
):
values = self._object_value_list(dataset_ref, predicate)
if values:
dataset_dict['extras'].append({'key': key,
'value': json.dumps(values)})
self._set_list_dataset_value(dataset_dict, key, values)

# Contact details
contact = self._contact_details(dataset_ref, DCAT.contactPoint)
Expand Down

0 comments on commit 9faf5f5

Please sign in to comment.