[ckan-changes] [okfn/ckan] da85db: [xs] pkg_dict should be created from database not ...

GitHub noreply at github.com
Thu May 3 12:58:24 UTC 2012


  Branch: refs/heads/release-v1.7
  Home:   https://github.com/okfn/ckan
  Commit: da85dbfbc1d032b5e0beb9d67c1ce81d8388de59
      https://github.com/okfn/ckan/commit/da85dbfbc1d032b5e0beb9d67c1ce81d8388de59
  Author: kindly <kindly at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M ckan/controllers/package.py

  Log Message:
  -----------
  [xs] pkg_dict should be created from database not repopulated data


diff --git a/ckan/controllers/package.py b/ckan/controllers/package.py
index 9e99e0f..346f1e7 100644
--- a/ckan/controllers/package.py
+++ b/ckan/controllers/package.py
@@ -452,16 +452,17 @@ def edit(self, id, data=None, errors=None, error_summary=None):
                    'user': c.user or c.author, 'extras_as_string': True,
                    'save': 'save' in request.params,
                    'moderated': config.get('moderated'),
-                   'for_edit': True,
                    'pending': True,}
 
         if context['save'] and not data:
             return self._save_edit(id, context)
         try:
+            c.pkg_dict = get_action('package_show')(context, {'id':id})
+            context['for_edit'] = True
             old_data = get_action('package_show')(context, {'id':id})
+            # old data is from the database and data is passed from the
+            # user if there is a validation error. Use users data if there.
             data = data or old_data
-            # Merge all elements for the complete package dictionary
-            c.pkg_dict = dict(old_data.items() + data.items())
         except NotAuthorized:
             abort(401, _('Unauthorized to read package %s') % '')
         except NotFound:


================================================================



More information about the ckan-changes mailing list