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

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


Author: torsten
Date: 2010-02-25 15:31:57 +0100 (Thu, 25 Feb 2010)
New Revision: 1793

Modified:
   wasko/branches/2.0/mpulsweb/lib/anonymize.py
Log:
* mpulsweb/lib/anonymize.py (_completeAnonymizedCase): Added
outcommented code to document which was done to complete the case on
anonymization in WASKO.


Modified: wasko/branches/2.0/mpulsweb/lib/anonymize.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/anonymize.py	2010-02-25 14:29:24 UTC (rev 1792)
+++ wasko/branches/2.0/mpulsweb/lib/anonymize.py	2010-02-25 14:31:57 UTC (rev 1793)
@@ -37,4 +37,39 @@
             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