[Mpuls-commits] r2399 - wasko/branches/2.0/mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Apr 16 11:20:24 CEST 2010
Author: torsten
Date: 2010-04-16 11:20:24 +0200 (Fri, 16 Apr 2010)
New Revision: 2399
Modified:
wasko/branches/2.0/mpulsweb/model/phase.py
Log:
* mpulsweb/model/phase.py (PhasePart.is_ok): Wald #1370. Fixed
checking if a phase can be switched into the next phase.
Modified: wasko/branches/2.0/mpulsweb/model/phase.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/phase.py 2010-04-16 09:03:24 UTC (rev 2398)
+++ wasko/branches/2.0/mpulsweb/model/phase.py 2010-04-16 09:20:24 UTC (rev 2399)
@@ -152,11 +152,11 @@
for phases in self:
p1, p2 = phases.getStart(), phases.getEnd()
if p1.id <= current_phase:
- if not p1.is_ok(fields):
+ if not p1.is_ok(fields, check_setting_phase=False):
raise ConsistenceCheckException(CASE_NOT_CONSISTENT
% phases.description)
if p2.id <= current_phase:
- if not p2.is_ok(fields):
+ if not p2.is_ok(fields, check_setting_phase=False):
raise ConsistenceCheckException(CASE_NOT_CONSISTENT
% phases.description)
@@ -254,20 +254,21 @@
def is_anonymizable(self):
return self.id not in g.mpuls_config.get('phases', 'notanonymizable')
+ def is_ok(self, fields=None, check_setting_phase=True):
- def is_ok(self, fields=None):
-
# 1. Simulate switching the phase
# Setting values will trigger evaluation error rules. This way we can
# check logic rules which are modeled as errors.
- #case_id = self.it.getRootNode().getIdentifier()
- #realid = "%s:%s" % (PHASEFIELD, case_id)
- #try:
- # values = {realid: self.id}
- # self.it.setData(values)
- #except:
- # log.exception('Can not set phase: %s' % values)
- # return False
+ if check_setting_phase:
+ case_id = self.it.getRootNode().getIdentifier()
+ realid = "%s:%s" % (PHASEFIELD, case_id)
+ try:
+ values = {realid: self.id}
+ self.it.setData(values)
+ return True
+ except:
+ return False
+
# 2. Check rules
for field in self.fields:
More information about the Mpuls-commits
mailing list