Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from datagovuk/resource-date-change-lost
Browse files Browse the repository at this point in the history
Fixes ckanext-dgu#275 using fix from ckan master ckan#2158
  • Loading branch information
rossjones committed Dec 21, 2015
2 parents 3ca4932 + 93ca22c commit dadeea2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ckan/lib/dictization/model_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def resource_dict_save(res_dict, context):
table = class_mapper(model.Resource).mapped_table
fields = [field.name for field in table.c]

new_extras = {}
for key, value in res_dict.iteritems():
if isinstance(value, list):
continue
Expand All @@ -48,12 +49,9 @@ def resource_dict_save(res_dict, context):
else:
# resources save extras directly onto the object, instead
# of in a separate extras field like packages and groups
obj.extras[key] = value
new_extras[key] = value

# Resource extras not submitted should be removed from the extras dict
extras_to_delete = set(obj.extras.keys()) - set(res_dict.keys())
for delete_me in extras_to_delete:
del obj.extras[delete_me]
obj.extras = new_extras

if context.get('pending'):
if session.is_modified(obj, include_collections=False, passive=True):
Expand Down

0 comments on commit dadeea2

Please sign in to comment.