[Mpuls-commits] r1743 - wasko/branches/2.0/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 24 12:27:34 CET 2010


Author: torsten
Date: 2010-02-24 12:27:33 +0100 (Wed, 24 Feb 2010)
New Revision: 1743

Modified:
   wasko/branches/2.0/mpulsweb/model/phase.py
Log:
* mpulsweb/model/phase.py: Check for each phasepart if it is running


Modified: wasko/branches/2.0/mpulsweb/model/phase.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/phase.py	2010-02-24 11:12:41 UTC (rev 1742)
+++ wasko/branches/2.0/mpulsweb/model/phase.py	2010-02-24 11:27:33 UTC (rev 1743)
@@ -6,6 +6,8 @@
 from formed.instance.backends.postgres import DBFactory as InstanceFactory
 from mpulsweb.lib.db import PostgresDBInterface
 
+PHASEFIELD = "phase" # name of the dbfield for phase
+
 log = logging.getLogger(__name__)
 
 class PhaseFactory:
@@ -56,6 +58,7 @@
 class PhasePart:
     def __init__(self, id, it):
         self.id = id
+        self.running = False
         self.fields = []
         pfields = g.mpuls_config.get('phases', 'fields')[0]
         for phasepart, fields in pfields.iteritems():          
@@ -67,6 +70,12 @@
                     if name:
                         self.fields.append(Field(name, page, rules, it))
 
+        # Check if the current phasepart is active
+        case_id = it.getRootNode().getIdentifier()
+        realid = "%s:%s" % (PHASEFIELD, case_id)
+        field = it.getItem(realid)
+        self.running = field.getValue() == int(self.id)
+
     def getLinks(self):
         out = []
         if len(self.fields) > 0:



More information about the Mpuls-commits mailing list