[ckan-changes] commit/ckan: kindly: [form] formalchemy preview sort out

Bitbucket commits-noreply at bitbucket.org
Mon Jul 4 22:13:12 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/270b2e785e0e/
changeset:   270b2e785e0e
branch:      feature-1141-moderated-edits-ajax
user:        kindly
date:        2011-07-05 00:12:48
summary:     [form] formalchemy preview sort out
affected #:  2 files (282 bytes)

--- a/ckan/controllers/package_formalchemy.py	Fri Jul 01 12:20:44 2011 +0200
+++ b/ckan/controllers/package_formalchemy.py	Mon Jul 04 23:12:48 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	Fri Jul 01 12:20:44 2011 +0200
+++ b/ckan/lib/package_saver.py	Mon Jul 04 23:12:48 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