diff --git a/ckanext/dcat/harvesters/rdf.py b/ckanext/dcat/harvesters/rdf.py index 05026f4f..58bc750d 100644 --- a/ckanext/dcat/harvesters/rdf.py +++ b/ckanext/dcat/harvesters/rdf.py @@ -18,7 +18,7 @@ from ckanext.dcat.harvesters.base import DCATHarvester from ckanext.dcat.processors import RDFParserException, RDFParser from ckanext.dcat.interfaces import IDCATRDFHarvester - +from ckan.logic import NotFound log = logging.getLogger(__name__) @@ -278,9 +278,13 @@ def import_stage(self, harvest_object): context = {'model': model, 'session': model.Session, 'user': self._get_user_name(), 'ignore_auth': True} - p.toolkit.get_action('package_delete')(context, {'id': harvest_object.package_id}) - log.info('Deleted package {0} with guid {1}'.format(harvest_object.package_id, - harvest_object.guid)) + try: + p.toolkit.get_action('package_delete')(context, {'id': harvest_object.package_id}) + log.info('Deleted package {0} with guid {1}'.format(harvest_object.package_id, + harvest_object.guid)) + except NotFound: + log.info('Package {0} already deleted.'.format(harvest_object.package_id)) + return True if harvest_object.content is None: