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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 17 11:31:22 CEST 2010


Author: torsten
Date: 2010-09-17 11:31:21 +0200 (Fri, 17 Sep 2010)
New Revision: 3719

Modified:
   base/trunk/mpulsweb/model/phase.py
Log:
* mpulsweb/model/phase.py: Make comparissons of phase ids more robust.  Cast the to int and str as needed.


Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py	2010-09-17 09:01:20 UTC (rev 3718)
+++ base/trunk/mpulsweb/model/phase.py	2010-09-17 09:31:21 UTC (rev 3719)
@@ -203,11 +203,10 @@
             current_phase = phase
         else:
             current_phase = self.get_current_phase_id()
-        path = self.get_path(current_phase)
+        path = self.get_path(str(current_phase))
         for phases in self:
             p1, p2 = phases.getStart(), phases.getEnd()
-            
-            if p1.id <= current_phase and p1.id in path:
+            if int(p1.id) <= int(current_phase) and p1.id in path:
                 if not p1.is_ok(fields, check_setting_phase=False):
                     errors = []
                     errors.append('<ol>')
@@ -217,7 +216,8 @@
                     raise ConsistenceCheckException(CASE_NOT_CONSISTENT
                                                     % (phases.description, "".join(errors)))
             
-            if p2.id <= current_phase and p2.id in path:
+            if int(p2.id) <= int(current_phase) and p2.id in path:
+                print p2.id 
                 if not p2.is_ok(fields, check_setting_phase=False):
                     errors = []
                     errors.append('<ol>')



More information about the Mpuls-commits mailing list