[Mpuls-commits] r1796 - wasko/branches/2.0/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 25 15:40:36 CET 2010


Author: torsten
Date: 2010-02-25 15:40:35 +0100 (Thu, 25 Feb 2010)
New Revision: 1796

Modified:
   wasko/branches/2.0/mpulsweb/lib/anonymize.py
Log:
Added some commented out code to document old behavior from waska. (needs to
be reimplemented)


Modified: wasko/branches/2.0/mpulsweb/lib/anonymize.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/anonymize.py	2010-02-25 14:35:26 UTC (rev 1795)
+++ wasko/branches/2.0/mpulsweb/lib/anonymize.py	2010-02-25 14:40:35 UTC (rev 1796)
@@ -13,9 +13,59 @@
     pass
     #raise AnonymizeCheckException('Anonymisierung ist derzeit noch nicht implementiert')
 
+    # The following lines document which test where made in WASKO to check if a
+    # case can be anonymized.
+
+    #    if ((not case.getState().phasesAreConsistent()
+    #         or not case.getState().phasesAreCompleted()
+    #         or not case.getState().getPhase() in (CM_ENDE, NB_ENDE))
+    #        and case.isYoungerThan(INCONSISTENCY_CHECK_AFTER)):
+    #        c.failed_for = MARKANONYMIZE_INCOMPLETE_PHASE_FAILED
+    #        if case.getState().getPhase() in (CLEAR_START, CLEAR_ENDE):
+    #            c.failed_text = \
+    #                        MARKANONYMIZE_CLEARING_PHASE_FAILED_TEXT
+    #        else:
+    #            c.failed_text = \
+    #                        MARKANONYMIZE_INCOMPLETE_PHASE_FAILED_TEXT
+    #        c.url_ok = "/case/digest/%s" % id
+    #        return render('/casemanagement/dialogs/failed_anonymize.mako')
+
 def anonymize(case):
-    pass
+    '''Fill all missing fields with "unknown" before mark for anonymization.
 
+       case: Case object
+    '''
+    # The follwing lines document which step are done in WASKO to complete a
+    # case.
+
+    #required_fields = RequiredFields(g.formedTree)
+    ## Special code to set "unbekannt" for missing fields.
+    #end_phase = _determineAnonymizedCaseEndPhase(case)
+    #fields = {}
+    #missing = required_fields.missingFields(phase_symbol(end_phase))
+    #for field in missing:
+    #    fieldname = field.getName()
+    #    if isinstance(field, DateLeaf):
+    #        fields[fieldname] = '01.01.0001'
+    #    elif isinstance(field, IntLeaf):
+    #        fields[fieldname] = '-9999999'
+    #    elif isinstance(field, TextLeaf):
+    #        fields[fieldname] = 'unbekannt'
+    #    elif isinstance(field, RadioNode) or isinstance(field, ChoiceNode):
+    #        if fieldname in ('hilfm_1','hilfm_2','hilfm_3'):
+    #            if g.formedTree.getData(fieldname, case.getId()) == -1:
+    #                fields[fieldname] = '0'
+    #        elif fieldname == 'cm_end_art':
+    #            # Due to a bug in rules/missing fields this is added to
+    #            # the list
+    #            pass
+    #        else:
+    #            fields[fieldname] = '-3'
+    ## Store
+    #g.formedTree.setData(fields, case.getId())
+    ## Set the phase
+    #case.getState().setPhase(end_phase)
+
 def determineAnonymizedCaseEndPhase(case):
     '''Determine the phase to be set for the anonymized case'''
     current_phase = case.getState().getPhase()
@@ -37,39 +87,4 @@
             return phase
     return str(-1)
 
-#def _completeAnonymizedCase(case):
-#    '''Fill all missing fields with "unknown" before mark for anonymization.
-#
-#       case: Case object
-#    '''
-#    required_fields = RequiredFields(g.formedTree)
-#    # Special code to set "unbekannt" for missing fields.
-#    end_phase = _determineAnonymizedCaseEndPhase(case)
-#    fields = {}
-#    missing = required_fields.missingFields(phase_symbol(end_phase))
-#    for field in missing:
-#        fieldname = field.getName()
-#        if isinstance(field, DateLeaf):
-#            fields[fieldname] = '01.01.0001'
-#        elif isinstance(field, IntLeaf):
-#            fields[fieldname] = '-9999999'
-#        elif isinstance(field, TextLeaf):
-#            fields[fieldname] = 'unbekannt'
-#        elif isinstance(field, RadioNode) or isinstance(field, ChoiceNode):
-#            if fieldname in ('hilfm_1','hilfm_2','hilfm_3'):
-#                if g.formedTree.getData(fieldname, case.getId()) == -1:
-#                    fields[fieldname] = '0'
-#            elif fieldname == 'cm_end_art':
-#                # Due to a bug in rules/missing fields this is added to
-#                # the list
-#                pass
-#            else:
-#                fields[fieldname] = '-3'
-#    # Store
-#    g.formedTree.setData(fields, case.getId())
-#    # Set the phase
-#    case.getState().setPhase(end_phase)
-
-
-
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list