Skip to content

Commit

Permalink
Merge branch '2519-upload-update-last-modified'
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Jul 15, 2015
2 parents fd20065 + 3e3a7c8 commit 097e6ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ckan/lib/dictization/model_save.py
Expand Up @@ -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 = {}
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions ckan/lib/uploader.py
Expand Up @@ -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'] = ''
Expand Down

0 comments on commit 097e6ce

Please sign in to comment.