[Mpuls-commits] r1854 - wasko/branches/2.0/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Feb 26 16:36:28 CET 2010


Author: torsten
Date: 2010-02-26 16:36:28 +0100 (Fri, 26 Feb 2010)
New Revision: 1854

Modified:
   wasko/branches/2.0/mpulsweb/controllers/privacy.py
Log:
Added dummycode to check only a subset of fields on decline of the declaration
of consent.


Modified: wasko/branches/2.0/mpulsweb/controllers/privacy.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/privacy.py	2010-02-26 15:11:31 UTC (rev 1853)
+++ wasko/branches/2.0/mpulsweb/controllers/privacy.py	2010-02-26 15:36:28 UTC (rev 1854)
@@ -7,9 +7,11 @@
 from mpulsweb.lib.security import checkRole
 from mpulsweb.lib.base import BaseController, render, c, h, session
 from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhase
+from mpulsweb.model.phase import ConsistenceCheckException 
 
 from mpulsweb.controllers.case import ANONYMIZE_CONFIRM, \
-    MARKANONYMIZE_CONFIRM_TEXT, MARKANONYMIZE_SUCCESS, MARKANONYMIZE_SUCCESS_TEXT \
+    MARKANONYMIZE_CONFIRM_TEXT, MARKANONYMIZE_SUCCESS, MARKANONYMIZE_SUCCESS_TEXT, \
+    MARKANONYMIZE_FAILED
 
 HEADER = u"""Einverständniserklärung setzen?"""
 ACCEPT_QUESTION = u"""\
@@ -86,15 +88,28 @@
         confirmed = self._checkBool(confirmed)
         case = self._loadCase(id)
 
-        # TODO: Implement check if the case fullfills the minimum requirement
-        # for abortion.
+        # Check if the case has set the minimum required fields.
+        # Thefore get a list of minimum required fields. This is usually the
+        # relevant date fields plus additionally some fields (e.g type of end
+        # of cm)
 
+        # TODO: Get minimum fields from mpuls_config 
+        #min_fields = g.mpuls_config...
+        min_fields = [] # Check all fields 
+        try:
+            case.check_anonymizeability(min_fields)
+        except ConsistenceCheckException, e:
+            c.dialog_title =  MARKANONYMIZE_FAILED
+            c.dialog_text  =  e.value 
+            c.url_ok = h.url_for(controller='/case', action='digest', id=case.id) 
+            return render('/casemanagement/dialogs/failed_markanonymize.mako')
+
         if confirmed:
             statement = case.getPrivacyStatement()
             statement.decline()
             # Mark case for anonymizion
-            #case.getState().setState(4)
-            #case.make_anonymizable()
+            case.getState().setState(4)
+            case.make_anonymizable()
 
             c.dialog_title = MARKANONYMIZE_SUCCESS
             c.dialog_text  = MARKANONYMIZE_SUCCESS_TEXT



More information about the Mpuls-commits mailing list