[Mpuls-commits] r4494 - base/trunk/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jan 14 11:55:19 CET 2011


Author: torsten
Date: 2011-01-14 11:55:18 +0100 (Fri, 14 Jan 2011)
New Revision: 4494

Modified:
   base/trunk/mpulsweb/controllers/settings.py
Log:
* mpulsweb/controllers/settings.py (SettingsController.editAction,
	SettingsController.edit):
	Use htmlfill render function to render form.


Modified: base/trunk/mpulsweb/controllers/settings.py
===================================================================
--- base/trunk/mpulsweb/controllers/settings.py	2011-01-13 10:59:18 UTC (rev 4493)
+++ base/trunk/mpulsweb/controllers/settings.py	2011-01-14 10:55:18 UTC (rev 4494)
@@ -33,10 +33,14 @@
 
     @checkRole('admin_ka')
     def edit(self):
+        c.agency = Agency()
         c.form_errors = {}
-        c.form_result = {}
-        c.agency = Agency()
-        return render('/settings/edit.mako')
+        c.form_result = c.agency.conf 
+        form = render('/settings/edit.mako')
+        return formencode.htmlfill.render(form,
+                                          defaults=c.form_result,
+                                          auto_insert_errors=False,
+                                          errors=c.form_errors)
 
     @checkRole('admin_ka')
     def editAction(self):
@@ -47,7 +51,11 @@
         except formencode.Invalid, error:
             c.form_result = error.value
             c.form_errors = error.error_dict or {}
-            return render('/settings/edit.mako')
+            form = render('/settings/edit.mako')
+            return formencode.htmlfill.render(form,
+                                              defaults=c.form_result,
+                                              auto_insert_errors=False,
+                                              errors=c.form_errors)
 
         c.agency.store(c.form_result)
         c.dialog_title = EDIT_AGENCY_SUCCESS_HEADER
@@ -55,4 +63,5 @@
         c.url_ok = url_for(controller='/settings')
         return render ('/settings/dialogs/success_edit.mako')
 
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list