[Mpuls-commits] r1852 - wasko/branches/2.0/mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Feb 26 16:07:22 CET 2010
Author: torsten
Date: 2010-02-26 16:07:20 +0100 (Fri, 26 Feb 2010)
New Revision: 1852
Modified:
wasko/branches/2.0/mpulsweb/model/case.py
Log:
Enable consistency and anonymize checks on a subset of fields
Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py 2010-02-26 15:06:33 UTC (rev 1851)
+++ wasko/branches/2.0/mpulsweb/model/case.py 2010-02-26 15:07:20 UTC (rev 1852)
@@ -253,17 +253,19 @@
"""Return a list with all names of fields to match in the search"""
return [field.name for field in cls.fields if field.search_match]
- def check_consistence(self):
+ def check_consistence(self, fields=None):
"""Raises ConsistenceCheckException if the case is not completly
consistent up to the current phase. A case is consistent if no required
- field are missing and all relevant dates on phases are set
+ field are missing and all relevant dates on phases are set.
+
+ fields: List of fieldnames which will be checked. On default all fields
+ will be checked
"""
- self.phaseslist.check_consistence()
+ self.phaseslist.check_consistence(fields)
- def check_anonymizeability(self):
+ def check_anonymizeability(self, fields=None):
"""Raises ConsistenceCheckException if the case is not in a anonymizable state.
"""
-
# Check if anonymization is allowed in the current phase
phasepart = self.phaseslist.get_current_phase()
desc = g.mpuls_config.get('phases', 'description')[0].get(phasepart.phase)
@@ -271,14 +273,14 @@
raise ConsistenceCheckException(
MARKANONYMIZE_FAILED_MIN_PHASE % desc)
+ #Check consistence
+ self.check_consistence(fields)
+
# Check if the current phase is currently running.
if isinstance(phasepart, StartPhasePart):
raise ConsistenceCheckException(
MARKANONYMIZE_FAILED_RUNNING_PHASE % desc)
- #Finally check consistence
- self.check_consistence()
-
def make_consistent(self):
"""Will ensure that the case is in a (minimal) consistent state. That
means that all missing required fields up to the current phase are set
More information about the Mpuls-commits
mailing list