[Mpuls-commits] r3759 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 22 15:48:57 CEST 2010


Author: bh
Date: 2010-09-22 15:48:55 +0200 (Wed, 22 Sep 2010)
New Revision: 3759

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/formularpage.py
Log:
* mpulsweb/controllers/formularpage.py
(FormularpageController.save)
(FormularpageController._handle_repeat_group_redirects): Move the
repeat group handling parts of FormularpageController.save into
the new method FormularpageController._handle_repeat_group_redirects


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-22 12:26:04 UTC (rev 3758)
+++ base/trunk/ChangeLog	2010-09-22 13:48:55 UTC (rev 3759)
@@ -1,3 +1,11 @@
+2010-09-22  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/controllers/formularpage.py
+	(FormularpageController.save)
+	(FormularpageController._handle_repeat_group_redirects): Move the
+	repeat group handling parts of FormularpageController.save into
+	the new method FormularpageController._handle_repeat_group_redirects
+
 2010-09-20  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* mpulsweb/public/styles/screen.css: Added class "disabled" style for formular

Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2010-09-22 12:26:04 UTC (rev 3758)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2010-09-22 13:48:55 UTC (rev 3759)
@@ -203,18 +203,8 @@
             session.save()
             
             # How to proceed after saving the data?
-            for param in request.params:
-                if param.startswith('add_rg') and not param.endswith(('x','y')):
-                    if param == 'add_rg':
-                        redirect_to(controller='/repeatgroup', action="new",
-                                    id=request.params.get('add_rg'))
-                    else:
-                        redirect_to(controller='/repeatgroup', action="new",
-                                    id=param.split('|')[1])
-                elif param.startswith('del_rg') and not param.endswith(('x','y')):
-                    redirect_to(controller='/repeatgroup', action="delete",
-                                id=param.split('|')[1])
-            
+            self._handle_repeat_group_redirects()
+
             if request.params.has_key('savenext'):
                 page_id = session['navigation.tree'].getTreeItem(page_id).nextKey().key
 
@@ -273,6 +263,22 @@
                     return render('/phase/dialogs/success_halfautomatic_set_phase.mako')
         return self.select(page_id)
 
+    def _handle_repeat_group_redirects(self):
+        """Redirect the appropriate repeat group action implied in the request
+        """
+        for param in request.params:
+            if param.startswith('add_rg') and not param.endswith(('x', 'y')):
+                if param == 'add_rg':
+                    redirect_to(controller='/repeatgroup', action="new",
+                                id=request.params.get('add_rg'))
+                else:
+                    redirect_to(controller='/repeatgroup', action="new",
+                                id=param.split('|')[1])
+            elif param.startswith('del_rg') and not param.endswith(('x', 'y')):
+                redirect_to(controller='/repeatgroup', action="delete",
+                            id=param.split('|')[1])
+
+
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
     def printout(self, id):
         c.print_version = 1



More information about the Mpuls-commits mailing list