Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix deletion in JSON Harvester #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions ckanext/dcat/harvesters/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,9 @@ 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

Expand Down Expand Up @@ -197,6 +195,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:
Expand Down