[ckan-changes] commit/ckanext-inspire: amercader: Make sure old extras are removed when updating packages

Bitbucket commits-noreply at bitbucket.org
Tue May 10 09:53:50 UTC 2011


1 new changeset in ckanext-inspire:

http://bitbucket.org/okfn/ckanext-inspire/changeset/645f7a73b7ad/
changeset:   r23:645f7a73b7ad
user:        amercader
date:        2011-05-10 11:53:33
summary:     Make sure old extras are removed when updating packages
affected #:  1 file (173 bytes)

--- a/ckanext/inspire/harvesters.py	Mon May 09 10:17:18 2011 +0100
+++ b/ckanext/inspire/harvesters.py	Tue May 10 10:53:33 2011 +0100
@@ -243,7 +243,6 @@
         for party_name in parties: 
             parties_extra.append('%s (%s)' % (party_name, ', '.join(parties[party_name])))
         extras['responsible-party'] = '; '.join(parties_extra)
-
         package_data = {
             'title': gemini_values['title'],
             'notes': gemini_values['abstract'],
@@ -364,6 +363,11 @@
             package.resources[:] = []
             package.resources.append(resource)
 
+        # Make sure old extras are removed if updating
+        if len(package.extras):
+            for key in package.extras.keys():
+                del package.extras[key]
+
         for key, value in package_data.get('extras', {}).iteritems():
             extra = PackageExtra(key=key, value=value)
             package._extras[key] = extra

Repository URL: https://bitbucket.org/okfn/ckanext-inspire/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list