diff --git a/pydatajson/ckan_utils.py b/pydatajson/ckan_utils.py index 196815c..842ae9c 100644 --- a/pydatajson/ckan_utils.py +++ b/pydatajson/ckan_utils.py @@ -40,6 +40,7 @@ def map_dataset_to_package(dataset, catalog_id): package['author_email'] = dataset['publisher'].get('mbox') append_attribute_to_extra(package, dataset, 'modified') append_attribute_to_extra(package, dataset, 'temporal') + append_attribute_to_extra(package, dataset, 'source') append_attribute_to_extra(package, dataset, 'language', serialize=True) spatial = dataset.get('spatial') @@ -95,6 +96,7 @@ def map_distributions_to_resources(distributions, catalog_id): resource['mimetype'] = distribution.get('mediaType') resource['size'] = distribution.get('byteSize') resource['accessURL'] = distribution.get('accessURL') + resource['fileName'] = distribution.get('fileName') dist_fields = distribution.get('field') if dist_fields: resource['attributesDescription'] = json.dumps(dist_fields) diff --git a/tests/test_ckan_utils.py b/tests/test_ckan_utils.py index fdf9469..7a1c2e6 100644 --- a/tests/test_ckan_utils.py +++ b/tests/test_ckan_utils.py @@ -100,7 +100,8 @@ def test_resources_replicated_attributes_stay_the_same(self): ('mimetype', 'mediaType'), ('description', 'description'), ('format', 'format'), - ('size', 'byteSize')] + ('size', 'byteSize'), + ('fileName', 'fileName')] for fst, snd in replicated_attributes: if distribution.get(snd): self.assertEqual(distribution.get(snd), resource.get(fst))