From f210455aef1c59a1c38dea691e7ffb32a9d3e53c Mon Sep 17 00:00:00 2001 From: amercader Date: Tue, 13 Mar 2012 12:38:14 +0000 Subject: [PATCH] [ckan harvester] Replace title on default extras --- README.rst | 1 + ckanext/harvest/harvesters/base.py | 1 + ckanext/harvest/harvesters/ckanharvester.py | 2 ++ 3 files changed, 4 insertions(+) diff --git a/README.rst b/README.rst index f40c748..2aea2d6 100644 --- a/README.rst +++ b/README.rst @@ -160,6 +160,7 @@ field. The currently supported configuration options are: * {dataset_id} * {harvest_source_id} * {harvest_source_url} # Will be stripped of trailing forward slashes (/) + * {harvest_source_title} # Requires CKAN 1.6 * {harvest_job_id} * {harvest_object_id} diff --git a/ckanext/harvest/harvesters/base.py b/ckanext/harvest/harvesters/base.py index e857c5f..189a5ad 100644 --- a/ckanext/harvest/harvesters/base.py +++ b/ckanext/harvest/harvesters/base.py @@ -153,6 +153,7 @@ class HarvesterBase(SingletonPlugin): else: log.info('Package with GUID %s not updated, skipping...' % harvest_object.guid) + return except NotFound: # Package needs to be created diff --git a/ckanext/harvest/harvesters/ckanharvester.py b/ckanext/harvest/harvesters/ckanharvester.py index 8a3c5fc..e9f1aeb 100644 --- a/ckanext/harvest/harvesters/ckanharvester.py +++ b/ckanext/harvest/harvesters/ckanharvester.py @@ -266,9 +266,11 @@ class CKANHarvester(HarvesterBase): if isinstance(value,basestring): value = value.format(harvest_source_id=harvest_object.job.source.id, harvest_source_url=harvest_object.job.source.url.strip('/'), + harvest_source_title=harvest_object.job.source.title, harvest_job_id=harvest_object.job.id, harvest_object_id=harvest_object.id, dataset_id=package_dict['id']) + package_dict['extras'][key] = value result = self._create_or_update_package(package_dict,harvest_object)