Skip to content

Commit

Permalink
Merge pull request #3 from datopian/fix/harvest-resource-delete
Browse files Browse the repository at this point in the history
Fixes  'cannot concatenate ‘str’ and ‘NoneType’ objects' error on deleting dataset from a JSON source
  • Loading branch information
MuhammadIsmailShahzad authored Sep 11, 2020
2 parents 29879de + 863701e commit 055c9b1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ckanext/dcat/harvesters/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

0 comments on commit 055c9b1

Please sign in to comment.