[Mpuls-commits] r5760 - base/trunk/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 10 12:33:43 CET 2012


Author: bricks
Date: 2012-01-10 12:33:42 +0100 (Tue, 10 Jan 2012)
New Revision: 5760

Modified:
   base/trunk/mpulsweb/model/phase.py
Log:
Add comment to be more clear between Phase and Phasepart.
Add PhasePart get_phase_name method to return the description/name of the phase without the part.

The Phase/PhasePart code should be refactored ...


Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py	2012-01-10 11:02:06 UTC (rev 5759)
+++ base/trunk/mpulsweb/model/phase.py	2012-01-10 11:33:42 UTC (rev 5760)
@@ -164,6 +164,7 @@
                 return phase
 
     def get_phase(self, id):
+        '''Returns the PhasePart of the id'''
         for p in self:
             if id == p.start.id: return p.start
             if id == p.end.id: return p.end
@@ -277,10 +278,10 @@
 
 class PhasePart:
 
-    def __init__(self, id, phase, suc, pre):
+    def __init__(self, id, phase_id, suc, pre):
         self.id = id
         self.it = None 
-        self.phase = phase
+        self.phase = phase_id
         self.active = False
         self.date = None
         self.datefield = None
@@ -414,7 +415,10 @@
         self.errors = errors
         return len(errors) == 0
 
+    def get_phase_name(self):
+        return g.mpuls_config.get('phases', 'description')[0].get(self.phase)
 
+
 class StartPhasePart(PhasePart):
     pass
 



More information about the Mpuls-commits mailing list