Skip to content

Commit

Permalink
Fix for ckan 2.9 and Revision exception
Browse files Browse the repository at this point in the history
  • Loading branch information
David Read committed Nov 22, 2019
1 parent 9ddaa1a commit c7fa204
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ckanext/archiver/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,13 @@ def save_archival(resource, status_id, reason, url_redirected_to,
log.info('Archival from before: %r', archival)
previous_archival_was_broken = archival.is_broken

revision = model.Session.query(model.Revision).get(resource['revision_id'])
archival.resource_timestamp = revision.timestamp
try:
revision = model.Session.query(model.Revision) \
.get(resource['revision_id'])
archival.resource_timestamp = revision.timestamp
except AttributeError:
# CKAN 2.9 doesn't have revisions, so we can't get a timestamp
pass

# Details of the latest archival attempt
archival.status_id = status_id
Expand Down

0 comments on commit c7fa204

Please sign in to comment.