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

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 12 13:33:31 CET 2012


Author: ludwig
Date: 2012-11-12 13:33:31 +0100 (Mon, 12 Nov 2012)
New Revision: 6140

Modified:
   base/trunk/mpulsweb/controllers/case.py
Log:
Bugfix: Handle case/new2 action before case/new action with redirect.


Modified: base/trunk/mpulsweb/controllers/case.py
===================================================================
--- base/trunk/mpulsweb/controllers/case.py	2012-11-12 11:51:29 UTC (rev 6139)
+++ base/trunk/mpulsweb/controllers/case.py	2012-11-12 12:33:31 UTC (rev 6140)
@@ -593,12 +593,15 @@
     @checkRole('cm')
     def new2(self):
         c.case = session.get('case')
-        form_errors = {}
-        form_defaults = c.case.getData()
-        form = render('/casemanagement/new.mako')
-        return formencode.htmlfill.render(form, defaults=form_defaults,
-                                          auto_insert_errors=False,
-                                          errors=form_errors)
+        if c.case is None:
+            redirect(url('new'))
+        else:
+            form_errors = {}
+            form_defaults = c.case.getData()
+            form = render('/casemanagement/new.mako')
+            return formencode.htmlfill.render(form, defaults=form_defaults,
+                                              auto_insert_errors=False,
+                                              errors=form_errors)
 
     def _add_custom_fields(self):
         '''This function should be overwritten in specific applications to add



More information about the Mpuls-commits mailing list