[Mpuls-commits] r1794 - wasko/branches/2.0/jmdweb/controllers

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


Author: torsten
Date: 2010-02-25 15:33:15 +0100 (Thu, 25 Feb 2010)
New Revision: 1794

Modified:
   wasko/branches/2.0/jmdweb/controllers/case.py
Log:
* jmdweb/controllers/case.py (_completeAnonymizedCase): Deleted.
Import from lib/anonymize now. Does currently nothing.


Modified: wasko/branches/2.0/jmdweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/case.py	2010-02-25 14:31:57 UTC (rev 1793)
+++ wasko/branches/2.0/jmdweb/controllers/case.py	2010-02-25 14:33:15 UTC (rev 1794)
@@ -42,7 +42,9 @@
 from mpulsweb.lib.base import c, g, h, redirect_to, render, request, session
 from mpulsweb.lib.db import db
 from mpulsweb.lib.navigation import get_navigation
-from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhase as _determineAnonymizedCaseEndPhase
+from mpulsweb.lib.anonymize import \
+    determineAnonymizedCaseEndPhase as _determineAnonymizedCaseEndPhase \
+    anonymize as _completeAnonymizedCase
 from mpulsweb.lib.security import checkRole
 
 from mpulsweb.model.appointment import CaseAppointmentFactory
@@ -182,41 +184,6 @@
             return render('/statement/dialogs/missing_statement.mako')
     return decorator(validate)
 
-
-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)
-
-
 class CaseController(MpulsCaseController):
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))



More information about the Mpuls-commits mailing list