[ckan-changes] commit/ckan: kindly: [form] 1209 fix iati preview

Bitbucket commits-noreply at bitbucket.org
Tue Jul 5 11:15:23 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/d959a70a19ea/
changeset:   d959a70a19ea
user:        kindly
date:        2011-07-05 13:14:52
summary:     [form] 1209 fix iati preview
affected #:  2 files (282 bytes)

--- a/ckan/controllers/package_formalchemy.py	Mon Jul 04 18:03:58 2011 +0100
+++ b/ckan/controllers/package_formalchemy.py	Tue Jul 05 12:14:52 2011 +0100
@@ -1,9 +1,11 @@
 import logging
 
+import urlparse
 from ckan.lib.base import BaseController, render, c, model, abort, request
 from ckan.lib.base import  config, h, ValidationException
 from ckan.lib.package_saver import PackageSaver
 from ckan.controllers.package import PackageController
+import ckan.forms
 from pylons.i18n import get_lang, _
 
 log = logging.getLogger(__name__)


--- a/ckan/lib/package_saver.py	Mon Jul 04 18:03:58 2011 +0100
+++ b/ckan/lib/package_saver.py	Tue Jul 05 12:14:52 2011 +0100
@@ -4,12 +4,10 @@
 from ckan.lib.base import *
 import ckan.rating
 from pylons import g
+from ckan.lib.dictization import table_dictize
 
 # Todo: Factor out unused original_name argument.
 
-class ValidationException(Exception):
-    pass
-
 class PackageSaver(object):
     '''Use this to validate, preview and save packages to the db.
     @param log_message: optional - only supply this if you want it validated
@@ -22,7 +20,14 @@
         Note that the actual calling of render('package/read') is left
         to the caller.'''
         pkg = cls._preview_pkg(fs, log_message, author, client=client)
-        cls.render_package(pkg)
+
+        pkg_dict = table_dictize(pkg, {'model': model})
+        pkg_dict['extras'] = []
+        c.pkg = pkg
+        for key, value in pkg.extras.iteritems():
+            pkg_dict['extras'].append(dict(key=key, value=value))
+
+        cls.render_package(pkg_dict, {'package': pkg})
 
     # TODO: rename to something more correct like prepare_for_render
     @classmethod

Repository URL: https://bitbucket.org/okfn/ckan/

--

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