Skip to content

Commit

Permalink
ignore already delete packages
Browse files Browse the repository at this point in the history
fixes ckan#238
  • Loading branch information
jze committed Jan 16, 2023
1 parent 618928b commit c6f0956
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ckanext/dcat/harvesters/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c6f0956

Please sign in to comment.