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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 15 19:47:01 CEST 2010


Author: torsten
Date: 2010-09-15 19:47:00 +0200 (Wed, 15 Sep 2010)
New Revision: 3656

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCase.check_anonymizeability): Issue1066: Adapted logic in controller to planned workflow for anonymisation


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2010-09-15 17:27:37 UTC (rev 3655)
+++ base/trunk/mpulsweb/model/case.py	2010-09-15 17:47:00 UTC (rev 3656)
@@ -724,6 +724,8 @@
         """Raises ConsistenceCheckException if the case is not in a
         anonymizable state. 
         """
+
+        # 1. Check if anonymisation is allowed in the current phase
         if phase is not None:
             phasepart = self.get_phaseslist().get_phase(phase)
         else:
@@ -736,13 +738,22 @@
             raise ConsistenceCheckException(h.literal(MARKANONYMIZE_FAILED_MIN_PHASE
                                             % desc))
 
-        #Check consistence
-        self.check_consistence(fields, phase)
+        # 2. Now determine if we will enforce full consistence or minimal
+        # consistence (e.g on abort)
+        minimal_condition = g.mpuls_config.get(
+                                'phases', 'minimal_consistence_conditon')
 
-        # Check if the current phase is currently running.
-        if isinstance(phasepart, StartPhasePart):
-            raise ConsistenceCheckException(h.literal(MARKANONYMIZE_FAILED_RUNNING_PHASE
-                                            % desc))
+        if True: # TODO: Evaluation minimalcondition
+            #Check full consistence
+            self.check_consistence()
+            # 3. Check if the case is currently running 
+            if isinstance(phasepart, StartPhasePart):
+                raise ConsistenceCheckException(
+                            h.literal(MARKANONYMIZE_FAILED_RUNNING_PHASE % desc))
+        else:
+            # Check minimal consistence. Also running cases can be anonymized.
+            min_fields = g.mpuls_config.get('phases', 'minimal_fields_to_anonymize') 
+            self.check_consistence(min_fields)
 
     def make_consistent(self):
         """Will ensure that the case is in a (minimal) consistent state. That



More information about the Mpuls-commits mailing list