[Mpuls-commits] r2635 - wasko/branches/2.0/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 5 10:28:46 CEST 2010


Author: torsten
Date: 2010-05-05 10:28:43 +0200 (Wed, 05 May 2010)
New Revision: 2635

Modified:
   wasko/branches/2.0/mpulsweb/model/case.py
Log:
Removed debugging


Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py	2010-05-05 08:27:52 UTC (rev 2634)
+++ wasko/branches/2.0/mpulsweb/model/case.py	2010-05-05 08:28:43 UTC (rev 2635)
@@ -669,7 +669,6 @@
     def getSessionCase(self):
         """Return a SessionCase object initialized from the current case"""
         fields = dict()
-        log.debug('a1')
         for field in self.get_session_fields():
             # FIXME: Ideally we would use
             # self.get_value(field.name) to get the value.  We use
@@ -678,32 +677,35 @@
             # (e.g. buildInfofield in
             # templates/casemanagement/main.mako) relies on.
             fields[field.alias] = getattr(self, field.alias)
-        log.debug('a2')
         if g.mpuls_config.is_enabled('case-module', 'privacy'):
             signed = self.getPrivacyStatement().isSigned()
         else:
             signed = True
-        log.debug('a3')
         return SessionCase(self.id, state=self.state,
                            privacy_statement=signed,
                            **fields)
 
-    def check_consistence(self, fields=None):
+    def check_consistence(self, fields=None, phase=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.
 
         fields: List of fieldnames which will be checked. On default all fields
                 will be checked
+        phase:  Id id phase for which the check will be done.
         """
-        self.get_phaseslist().check_consistence(fields)
+        self.get_phaseslist().check_consistence(fields, phase)
 
-    def check_anonymizeability(self, fields=None, only_on_endphase=True):
+    def check_anonymizeability(self, fields=None, phase=None):
         """Raises ConsistenceCheckException if the case is not in a
-        anonymizable state.
+        anonymizable state. 
         """
+        if phase is not None:
+            phasepart = self.get_phaseslist().get_phase(phase)
+        else:
+            phasepart = self.get_phaseslist().get_current_phase()
+
         # Check if anonymization is allowed in the current phase
-        phasepart = self.get_phaseslist().get_current_phase()
         desc = g.mpuls_config.get('phases',
                                   'description')[0].get(phasepart.phase)
         if not phasepart.is_anonymizable():
@@ -711,10 +713,10 @@
                                             % desc))
 
         #Check consistence
-        self.check_consistence(fields)
+        self.check_consistence(fields, phase)
 
         # Check if the current phase is currently running.
-        if isinstance(phasepart, StartPhasePart) and only_on_endphase:
+        if isinstance(phasepart, StartPhasePart):
             raise ConsistenceCheckException(h.literal(MARKANONYMIZE_FAILED_RUNNING_PHASE
                                             % desc))
 



More information about the Mpuls-commits mailing list