From 064030c2dd19e3845af56d022d0cd53c38f2f8ab Mon Sep 17 00:00:00 2001 From: CKAN User Date: Tue, 17 May 2022 22:51:15 +0000 Subject: [PATCH 1/2] Allow objects with cleared job ids --- .gitignore | 2 ++ ckanext/spatial/harvesters/base.py | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3304cfaa..9ef14ace 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ syntax: glob *~ dist build +.vscode/ +.idea/ \ No newline at end of file diff --git a/ckanext/spatial/harvesters/base.py b/ckanext/spatial/harvesters/base.py index 625b462d..6a54ef70 100644 --- a/ckanext/spatial/harvesters/base.py +++ b/ckanext/spatial/harvesters/base.py @@ -683,9 +683,11 @@ def import_stage(self, harvest_object): # Check if the modified date is more recent if not self.force_import and previous_object and harvest_object.metadata_modified_date <= previous_object.metadata_modified_date: - # Assign the previous job id to the new object to - # avoid losing history - harvest_object.harvest_job_id = previous_object.job.id + # Assign the previous job id (if it hasn't been cleared) to the new object to avoid losing history + if previous_object.job: + harvest_object.harvest_job_id = previous_object.job.id + else: + harvest_object.harvest_job_id = None harvest_object.add() # Delete the previous object to avoid cluttering the object table From fbe5d1eedfd8055e27ac5759c0e024dc937ee4f4 Mon Sep 17 00:00:00 2001 From: bonnland Date: Tue, 17 May 2022 23:52:40 -0600 Subject: [PATCH 2/2] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9ef14ace..e40c4901 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ syntax: glob dist build .vscode/ -.idea/ \ No newline at end of file +.idea/