diff --git a/ckanext/dcat/harvesters/_json.py b/ckanext/dcat/harvesters/_json.py index d4a025ef..5e2d5c2d 100644 --- a/ckanext/dcat/harvesters/_json.py +++ b/ckanext/dcat/harvesters/_json.py @@ -165,11 +165,8 @@ def gather_stage(self, harvest_job): guid=guid, job=harvest_job, package_id=guid_to_package_id[guid], extras=[HarvestObjectExtra(key='status', value='delete')]) - ids.append(obj.id) - model.Session.query(HarvestObject).\ - filter_by(guid=guid).\ - update({'current': False}, False) obj.save() + ids.append(obj.id) return ids @@ -197,6 +194,11 @@ def import_stage(self, harvest_object): log.info('Deleted package {0} with guid {1}' .format(harvest_object.package_id, harvest_object.guid)) + model.Session.query(HarvestObject).\ + filter_by(guid=harvest_object.guid).\ + filter_by(current=True).\ + update({'current': False}, False) + return True if harvest_object.content is None: