From b68aea654b04e85562a32348aa99c6545567e653 Mon Sep 17 00:00:00 2001 From: Rae Knowler Date: Thu, 2 Nov 2023 12:37:43 +0100 Subject: [PATCH] feat: Move permalink construction into a helper function --- ckanext/dcatapchharvest/dcat_helpers.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ckanext/dcatapchharvest/dcat_helpers.py b/ckanext/dcatapchharvest/dcat_helpers.py index 3fa792d..36ae498 100644 --- a/ckanext/dcatapchharvest/dcat_helpers.py +++ b/ckanext/dcatapchharvest/dcat_helpers.py @@ -103,13 +103,16 @@ def dataset_uri(dataset_dict, dataset_ref=None): uri = '' break if not uri: - site_url = config.get('ckan.site_url') - uri = u'{0}/perma/{1}'.format(site_url, - dataset_dict.get('identifier')) + uri = get_permalink(dataset_dict.get('identifier')) return uri +def get_permalink(identifier): + site_url = config.get('ckan.site_url') + return u'{0}/perma/{1}'.format(site_url, identifier) + + def resource_uri(resource_dict, distribution=None): """ Returns a URI for the resource