[Mpuls-commits] r2432 - wasko/branches/2.0/mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Apr 20 12:35:31 CEST 2010
Author: torsten
Date: 2010-04-20 12:35:30 +0200 (Tue, 20 Apr 2010)
New Revision: 2432
Modified:
wasko/branches/2.0/mpulsweb/model/phase.py
Log:
* mpulsweb/model/phase.py (PhaseList.get_path): Added root to the path
* mpulsweb/model/phase.py (PhaseList.is_on_path): Added help function
to check if a phase is on path to a other phase part.
Modified: wasko/branches/2.0/mpulsweb/model/phase.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/phase.py 2010-04-20 09:32:53 UTC (rev 2431)
+++ wasko/branches/2.0/mpulsweb/model/phase.py 2010-04-20 10:35:30 UTC (rev 2432)
@@ -142,8 +142,13 @@
for pp in self.pre.get(phasepart_id, []):
path.extend(self.get_path(pp))
path.append(pp)
+ path.append(phasepart_id)
return path
+ def is_on_path(self, findid, pathend):
+ findid = str(findid)
+ return findid in self.get_path(pathend)
+
def is_valid(self):
'''Returns true if all phaseparts up to the current phase are ok.
This means all requierd fields are filled out and all checks for
@@ -157,13 +162,14 @@
def check_consistence(self, fields=None):
current_phase = self.get_current_phase_id()
+ path = self.get_path(current_phase)
for phases in self:
p1, p2 = phases.getStart(), phases.getEnd()
- if p1.id <= current_phase:
+ if p1.id <= current_phase and p1.id in path:
if not p1.is_ok(fields, check_setting_phase=False):
raise ConsistenceCheckException(CASE_NOT_CONSISTENT
% phases.description)
- if p2.id <= current_phase:
+ if p2.id <= current_phase and p2.id in path:
if not p2.is_ok(fields, check_setting_phase=False):
raise ConsistenceCheckException(CASE_NOT_CONSISTENT
% phases.description)
More information about the Mpuls-commits
mailing list