From 26cdc1089dfee1ef10bc4bbeb324e26e236f3445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Mercader?= Date: Wed, 11 May 2011 17:07:05 +0100 Subject: [PATCH] Change date definitions in Harvest Objects. reference_date -> metadata_modified_date, created -> gathered --- ckanext/harvest/harvesters.py | 4 ++-- ckanext/harvest/lib/__init__.py | 8 ++++---- ckanext/harvest/model/__init__.py | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ckanext/harvest/harvesters.py b/ckanext/harvest/harvesters.py index 96fce3c..22116c5 100644 --- a/ckanext/harvest/harvesters.py +++ b/ckanext/harvest/harvesters.py @@ -148,8 +148,8 @@ class CKANHarvester(SingletonPlugin): # http://ec2-46-51-149-132.eu-west-1.compute.amazonaws.com:8081/api/2/rest/package/77d93608-3a3e-42e5-baab-3521afb504f1 package_dict = json.loads(harvest_object.content) - # Save reference date in Harvest Object - harvest_object.reference_date = package_dict['metadata_modified'] + # Save metadata modified date in Harvest Object + harvest_object.metadata_modified_date = package_dict['metadata_modified'] harvest_object.save() ## change default schema diff --git a/ckanext/harvest/lib/__init__.py b/ckanext/harvest/lib/__init__.py index c7d8e04..5a627ee 100644 --- a/ckanext/harvest/lib/__init__.py +++ b/ckanext/harvest/lib/__init__.py @@ -326,15 +326,15 @@ def import_last_objects(source_id=None): .filter(HarvestJob.source==source) \ .filter(HarvestObject.package!=None) \ .order_by(HarvestObject.guid) \ - .order_by(HarvestObject.reference_date.desc()) \ - .order_by(HarvestObject.created.desc()) \ + .order_by(HarvestObject.metadata_modified_date.desc()) \ + .order_by(HarvestObject.gathered.desc()) \ .all() else: last_objects = Session.query(HarvestObject) \ .filter(HarvestObject.package!=None) \ .order_by(HarvestObject.guid) \ - .order_by(HarvestObject.reference_date.desc()) \ - .order_by(HarvestObject.created.desc()) \ + .order_by(HarvestObject.metadata_modified_date.desc()) \ + .order_by(HarvestObject.gathered.desc()) \ .all() diff --git a/ckanext/harvest/model/__init__.py b/ckanext/harvest/model/__init__.py index b0f12a8..6dff685 100644 --- a/ckanext/harvest/model/__init__.py +++ b/ckanext/harvest/model/__init__.py @@ -119,13 +119,13 @@ harvest_job_table = Table('harvest_job', metadata, harvest_object_table = Table('harvest_object', metadata, Column('id', types.UnicodeText, primary_key=True, default=make_uuid), Column('guid', types.UnicodeText, default=''), - Column('reference_date', DateTime), - Column('created', DateTime, default=datetime.datetime.utcnow), - Column('content', types.UnicodeText, nullable=True), - Column('harvest_job_id', types.UnicodeText, ForeignKey('harvest_job.id')), + Column('gathered', DateTime, default=datetime.datetime.utcnow), Column('fetch_started', DateTime), + Column('content', types.UnicodeText, nullable=True), Column('fetch_finished', DateTime), + Column('metadata_modified_date', DateTime), Column('retry_times',types.Integer), + Column('harvest_job_id', types.UnicodeText, ForeignKey('harvest_job.id')), Column('package_id', types.UnicodeText, ForeignKey('package.id'), nullable=True), ) # New table