[Mpuls-commits] r3789 - in wasko/trunk: . waskoweb/controllers

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


Author: bh
Date: 2010-09-27 15:56:22 +0200 (Mon, 27 Sep 2010)
New Revision: 3789

Modified:
   wasko/trunk/ChangeLog
   wasko/trunk/waskoweb/controllers/formularpage.py
Log:
* waskoweb/controllers/formularpage.py
(FormularpageController.save): Use the base class method
_handle_automatic_phase_change for the automatic phase change
feature.  The inline code for that feature was identical to the
contents of that base class method.


Modified: wasko/trunk/ChangeLog
===================================================================
--- wasko/trunk/ChangeLog	2010-09-27 13:54:49 UTC (rev 3788)
+++ wasko/trunk/ChangeLog	2010-09-27 13:56:22 UTC (rev 3789)
@@ -2,6 +2,14 @@
 
 	* waskoweb/controllers/formularpage.py
 	(FormularpageController.save): Use the base class method
+	_handle_automatic_phase_change for the automatic phase change
+	feature.  The inline code for that feature was identical to the
+	contents of that base class method.
+
+2010-09-27  Bernhard Herzog  <bh at intevation.de>
+
+	* waskoweb/controllers/formularpage.py
+	(FormularpageController.save): Use the base class method
 	_handle_repeat_group_redirects to handle the repeat group actions.
 	The inline code for this is identical to the contents of that base
 	class method.

Modified: wasko/trunk/waskoweb/controllers/formularpage.py
===================================================================
--- wasko/trunk/waskoweb/controllers/formularpage.py	2010-09-27 13:54:49 UTC (rev 3788)
+++ wasko/trunk/waskoweb/controllers/formularpage.py	2010-09-27 13:56:22 UTC (rev 3789)
@@ -218,46 +218,8 @@
                 appointment.store()
         
         
-        """
-        (Half)Automatic phase change
-        """
-        changemode = g.mpuls_config.get('phases', 'changemode')
-        if changemode != PC_MANUAL:
-            phases = PhaseFactory().load(session['case'].id)
-            log.debug("current phase: %s" % phases.get_current_phase_id())
-            log.debug("max phase? %s" % phases.get_max_phase_id())
-            current_phase = phases.get_current_phase_id()
-            log.debug(g.mpuls_config.get('phases', 'description'))
-            reachable_phase = phases.get_max_phase_id()
-            if current_phase != reachable_phase:
-                cpd = phases.get_phase(current_phase).getDescription() 
-                rpd = phases.get_phase(reachable_phase).getDescription() 
-                if changemode == PC_FULLAUTO:
-                    log.debug("fullautomatic phase change!")
-                    #load case and set phase
-                    case = g.case_factory.loadById(session['case'].id)
-                    case.getState().setPhase(reachable_phase)
-                    # build dialog
-                    c.dialog_title = DIALOG_FULLAUTOMATIC_CHANGE_TITLE
-                    c.dialog_text = DIALOG_FULLAUTOMATIC_CHANGE_TEXT \
-                    % (cpd, rpd)
-                    c.url_ok = url_for(controller="formularpage", 
-                                         action="select", 
-                                         id=page_id)  
-                    return render('/phase/dialogs/success_fullautomatic_set_phase.mako')
-                else:
-                    log.debug("halfautomatic phase change!")
-                    # build dialog
-                    c.dialog_title = DIALOG_HALFAUTOMATIC_CHANGE_TITLE 
-                    c.dialog_text = DIALOG_HALFAUTOMATIC_CHANGE_TEXT \
-                    % (cpd, rpd)
-                    c.url_ok = url_for(controller="phase", 
-                                         action="setPhase", 
-                                         id=session['case'].id,
-                                         value=reachable_phase)  
-                    c.url_no = url_for(controller="formularpage", 
-                                         action="select", 
-                                         id=page_id)
-                    return render('/phase/dialogs/success_halfautomatic_set_phase.mako')
+        phase_changed = self._handle_automatic_phase_change(page_id)
+        if phase_changed:
+            return phase_changed
 
         return self.select(page_id)



More information about the Mpuls-commits mailing list