[ckan harvester] Replace title on default extras

This commit is contained in:
amercader 2012-03-13 12:38:14 +00:00
parent e0bef2ef9c
commit f210455aef
3 changed files with 4 additions and 0 deletions

View File

@ -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}

View File

@ -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

View File

@ -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)