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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 3 11:16:17 CEST 2010


Author: torsten
Date: 2010-08-03 11:16:17 +0200 (Tue, 03 Aug 2010)
New Revision: 3312

Modified:
   base/trunk/mpulsweb/controllers/phase.py
Log:
* mpulsweb/controllers/phase.py (PhaseController.editAction): Moved logic to set a phase into a separate function. This way setting the phase can be called from other places to.



Modified: base/trunk/mpulsweb/controllers/phase.py
===================================================================
--- base/trunk/mpulsweb/controllers/phase.py	2010-08-03 09:14:42 UTC (rev 3311)
+++ base/trunk/mpulsweb/controllers/phase.py	2010-08-03 09:16:17 UTC (rev 3312)
@@ -29,6 +29,19 @@
         return render('/phase/phase.mako')
 
     @checkRole(('cm_ka'))
+    def setPhase(self, id, value):
+        case = self._loadCase(id)
+        # Set phase
+        state = case.getState()
+        state.setPhase(value)
+
+        # After setting the phase. Show print-dialog
+        c.dialog_title = SET_PHASE_NOTIFICATION_SUCCESS
+        c.dialog_text = SET_PHASE_NOTIFICATION_TEXT_SUCCESS
+        c.url_ok = h.url_for(controller='/phase', action='overview', id=case.id)
+        return render('/phase/dialogs/success_set_phase.mako')
+
+    @checkRole(('cm_ka'))
     def editAction(self):
         case = self._loadCase(request.params.get('case_id'))
         newphase = None
@@ -44,13 +57,4 @@
             except:
                 pass # convert failed, seems not to be the submit button.
                      # Continue...
-
-        # Set phase
-        state = case.getState()
-        state.setPhase(newphase)
-
-        # After setting the phase. Show print-dialog
-        c.dialog_title = SET_PHASE_NOTIFICATION_SUCCESS
-        c.dialog_text = SET_PHASE_NOTIFICATION_TEXT_SUCCESS
-        c.url_ok = h.url_for(controller='/phase', action='overview', id=case.id)
-        return render('/phase/dialogs/success_set_phase.mako')
+        return self.setPhase(request.params.get('case_id'), newphase)



More information about the Mpuls-commits mailing list