From 93ca22c6b3c6d761b27c0a51ac1dc1840f5744ca Mon Sep 17 00:00:00 2001 From: David Read Date: Fri, 18 Dec 2015 18:05:49 +0000 Subject: [PATCH] Fixes ckanext-dgu#275 using fix from ckan master #2158 - commit 8f5f161c39. --- ckan/lib/dictization/model_save.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ckan/lib/dictization/model_save.py b/ckan/lib/dictization/model_save.py index f1d1857eec7..95e6f6a5f5d 100644 --- a/ckan/lib/dictization/model_save.py +++ b/ckan/lib/dictization/model_save.py @@ -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 @@ -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):