diff --git a/ckan/lib/dictization/model_save.py b/ckan/lib/dictization/model_save.py index ad0c1e8e454..cfdf4973217 100644 --- a/ckan/lib/dictization/model_save.py +++ b/ckan/lib/dictization/model_save.py @@ -27,7 +27,6 @@ def resource_dict_save(res_dict, context): table = class_mapper(model.Resource).mapped_table fields = [field.name for field in table.c] - # Resource extras not submitted will be removed from the existing extras # dict new_extras = {} @@ -40,7 +39,9 @@ def resource_dict_save(res_dict, context): if isinstance(getattr(obj, key), datetime.datetime): if getattr(obj, key).isoformat() == value: continue - if key == 'url' and not new and obj.url <> value: + if key == 'last_modified' and not new: + obj.url_changed = True + if key == 'url' and not new and obj.url != value: obj.url_changed = True setattr(obj, key, value) else: diff --git a/ckan/lib/uploader.py b/ckan/lib/uploader.py index f9246386d2b..775f8adac1b 100644 --- a/ckan/lib/uploader.py +++ b/ckan/lib/uploader.py @@ -173,6 +173,7 @@ def __init__(self, resource): self.filename = munge.munge_filename(self.filename) resource['url'] = self.filename resource['url_type'] = 'upload' + resource['last_modified'] = datetime.datetime.utcnow() self.upload_file = upload_field_storage.file elif self.clear: resource['url_type'] = ''