[Mpuls-commits] r1783 - wasko/branches/2.0/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Feb 25 15:14:44 CET 2010
Author: torsten
Date: 2010-02-25 15:14:44 +0100 (Thu, 25 Feb 2010)
New Revision: 1783
Modified:
wasko/branches/2.0/mpulsweb/lib/anonymize.py
Log:
* mpulsweb/lib/anonymize.py (determineAnonymizedCaseEndPhase): New.
Fucntion to determine the final phase of the case after anonymisation.
Modified: wasko/branches/2.0/mpulsweb/lib/anonymize.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/anonymize.py 2010-02-25 14:13:37 UTC (rev 1782)
+++ wasko/branches/2.0/mpulsweb/lib/anonymize.py 2010-02-25 14:14:44 UTC (rev 1783)
@@ -1,13 +1,40 @@
# -*- coding: utf-8 -*-
+from pylons import app_globals as g
+import logging
+
+log = logging.getLogger(__name__)
+
class AnonymizeCheckException(Exception):
def __init__(self, value):
self.value = value
def check_state(case):
- raise AnonymizeCheckException('Das ist ein Test')
+ pass
+ #raise AnonymizeCheckException('Anonymisierung ist derzeit noch nicht implementiert')
def anonymize(case):
pass
+def determineAnonymizedCaseEndPhase(case):
+ '''Determine the phase to be set for the anonymized case'''
+ current_phase = case.getState().getPhase()
+ end_phase = -1
+ log.debug("currentphase: %s" % current_phase)
+
+ # Phase usually start which id 0. Each phase as start and end. End phase
+ # will be used on anonymization.
+ if current_phase%2:
+ end_phase = current_phase+1
+ elif current_phase == 0:
+ end_phase = 1
+ else:
+ end_phase = current_phase
+
+ log.debug("endphase: %s" % end_phase)
+ for phase, pairs in g.mpuls_config.get('phases', 'pairs')[0].iteritems():
+ if str(end_phase) in pairs:
+ return phase
+ return str(-1)
+
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
More information about the Mpuls-commits
mailing list