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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 27 15:54:50 CEST 2010


Author: bh
Date: 2010-09-27 15:54:49 +0200 (Mon, 27 Sep 2010)
New Revision: 3788

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/formularpage.py
Log:
* mpulsweb/controllers/formularpage.py (FormularpageController.save)
(FormularpageController._handle_automatic_phase_change): Move the
automatic phase change code from the save method to the new method
_handle_automatic_phase_change.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-27 13:23:29 UTC (rev 3787)
+++ base/trunk/ChangeLog	2010-09-27 13:54:49 UTC (rev 3788)
@@ -1,3 +1,10 @@
+2010-09-27  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/controllers/formularpage.py (FormularpageController.save)
+	(FormularpageController._handle_automatic_phase_change): Move the
+	automatic phase change code from the save method to the new method
+	_handle_automatic_phase_change.
+
 2010-09-24  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* mpulsweb/templates/casemanagement/digest.mako: Issue1121: Changed

Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2010-09-27 13:23:29 UTC (rev 3787)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2010-09-27 13:54:49 UTC (rev 3788)
@@ -222,7 +222,14 @@
             session['uncommited_fields'] = instance_tree.commit()
             session.save()
 
-        # Check requried fields of the case and set phase 
+        phase_changed = self._handle_automatic_phase_change(page_id)
+        if phase_changed:
+            return phase_changed
+
+        return self.select(page_id)
+
+    def _handle_automatic_phase_change(self, page_id):
+        """Change Phase automatically depending on the state of the case"""
         changemode = g.mpuls_config.get('phases', 'changemode')
         if changemode != PC_MANUAL:
             phases = PhaseFactory().load(session['case'].id)
@@ -261,7 +268,7 @@
                                          action="select", 
                                          id=page_id)
                     return render('/phase/dialogs/success_halfautomatic_set_phase.mako')
-        return self.select(page_id)
+        return None
 
     def _handle_repeat_group_redirects(self):
         """Redirect the appropriate repeat group action implied in the request



More information about the Mpuls-commits mailing list