[Mpuls-commits] r2448 - in wasko/branches/2.0: . mpulsweb/controllers mpulsweb/lib mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Apr 21 15:06:22 CEST 2010


Author: roland
Date: 2010-04-21 15:05:08 +0200 (Wed, 21 Apr 2010)
New Revision: 2448

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/controllers/case.py
   wasko/branches/2.0/mpulsweb/lib/anonymize.py
   wasko/branches/2.0/mpulsweb/model/case.py
Log:
fix error that caused anonymisation to fail

Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-04-21 13:04:54 UTC (rev 2447)
+++ wasko/branches/2.0/ChangeLog	2010-04-21 13:05:08 UTC (rev 2448)
@@ -3,6 +3,11 @@
 	* mpulsweb/model/case.py: Wald issue #1419: missing h.literal
 	* mpulsweb/templates/casemanagement/new.mako: Wald issue #1420: wrong
         link in breadcrumb
+	* mpulsweb/model/case.py:
+	* mpulsweb/controllers/case.py:
+	* mpulsweb/controllers/privacy.py:
+	* mpulsweb/lib/anonymize.py: fix error with function determineAnonymizedCaseEndPhase
+        which caused anynimisation to fail while being on certain phases
 
 2010-04-20  Torsten Irländer <torsten.irlaender at intevation.de>
 

Modified: wasko/branches/2.0/mpulsweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/case.py	2010-04-21 13:04:54 UTC (rev 2447)
+++ wasko/branches/2.0/mpulsweb/controllers/case.py	2010-04-21 13:05:08 UTC (rev 2448)
@@ -12,7 +12,7 @@
 from mpulsweb.lib.security import checkRole
 from mpulsweb.lib.dialogs import checkPrivacyStatement
 from mpulsweb.lib.validators import SetStandinForm, SetEditorForm
-from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhase
+from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhaseName
 from mpulsweb.model.case import ConsistenceCheckException, SessionCase
 from mpulsweb.model.user import UserGroupList, UserListObject
 from mpulsweb.model.logbook import LogbookEntry
@@ -170,7 +170,8 @@
         else:
             # Get description of the phase which will be set after anonymisation
             pdescriptions = g.mpuls_config.get('phases', 'description')[0]
-            phase = pdescriptions.get(determineAnonymizedCaseEndPhase(case))
+            
+            phase = pdescriptions.get(determineAnonymizedCaseEndPhaseName(case))
             c.dialog_title = ANONYMIZE_CONFIRM
             c.dialog_text = MARKANONYMIZE_CONFIRM_TEXT % phase
             c.url_yes = "/case/markForAnonymize/%s/1" % id

Modified: wasko/branches/2.0/mpulsweb/lib/anonymize.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/anonymize.py	2010-04-21 13:04:54 UTC (rev 2447)
+++ wasko/branches/2.0/mpulsweb/lib/anonymize.py	2010-04-21 13:05:08 UTC (rev 2448)
@@ -6,7 +6,7 @@
 log = logging.getLogger(__name__)
 
 def determineAnonymizedCaseEndPhase(case):
-    '''Determine the phase to be set for the anonymized case'''
+    '''Determine the phase ID to be set for the anonymized case'''
     current_phase = case.getState().getPhase()
     end_phase = -1
     log.debug("currentphase: %s" % current_phase)
@@ -21,6 +21,14 @@
         end_phase = current_phase + 1
 
     log.debug("endphase: %s" % end_phase)
+    return end_phase
+
+
+
+def determineAnonymizedCaseEndPhaseName(case):
+    '''Determine the phase name to be set for the anonymized case'''
+    end_phase = determineAnonymizedCaseEndPhase(case)
+    
     for phase, pairs in g.mpuls_config.get('phases', 'pairs')[0].iteritems():
         if str(end_phase) in pairs:
             return phase

Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py	2010-04-21 13:04:54 UTC (rev 2447)
+++ wasko/branches/2.0/mpulsweb/model/case.py	2010-04-21 13:05:08 UTC (rev 2448)
@@ -682,8 +682,8 @@
 
         # Check if the current phase is currently running.
         if isinstance(phasepart, StartPhasePart):
-            raise ConsistenceCheckException(MARKANONYMIZE_FAILED_RUNNING_PHASE
-                                            % desc)
+            raise ConsistenceCheckException(h.literal(MARKANONYMIZE_FAILED_RUNNING_PHASE
+                                            % desc))
 
     def make_consistent(self):
         """Will ensure that the case is in a (minimal) consistent state. That
@@ -730,7 +730,7 @@
         # Check if the current phase is already finished. If not then set to
         # finished
         end_phase = determineAnonymizedCaseEndPhase(self)
-        data['%s:%s' % (PHASEFIELD, self.id)] = end_phase
+        data['%s:%s' % (PHASEFIELD, self.id)] = str(end_phase)
         self.formed_instance.setData(data)
 
         # Ensurse consistence of the case



More information about the Mpuls-commits mailing list