[Mpuls-commits] r2117 - wasko/branches/2.0/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 24 15:50:47 CET 2010


Author: torsten
Date: 2010-03-24 15:50:47 +0100 (Wed, 24 Mar 2010)
New Revision: 2117

Modified:
   wasko/branches/2.0/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (Case.anonymize) (Case.restore): New copied
	from jmdweb.


Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py	2010-03-24 14:46:45 UTC (rev 2116)
+++ wasko/branches/2.0/mpulsweb/model/case.py	2010-03-24 14:50:47 UTC (rev 2117)
@@ -82,6 +82,7 @@
     UPDATE master_tbl_view
     SET phase = %(phase)s
     WHERE id IN (SELECT master_id FROM ka_status_tbl_view WHERE id = %(id)s)"""
+ANONYMIZE_CASE = """SELECT anonymize_case_wrapper(%(id)s)"""
 
 #DIALOGS
 MARKANONYMIZE_FAILED_MIN_PHASE = u"""\
@@ -701,6 +702,31 @@
             db.recycleConnection(conn, cur)
         return False
 
+    def anonymize(self):
+        """Deleted personal data in the case"""
+        conn, cur = None, None
+        try:
+            try:
+                conn = db.getConnection()
+                cur  = conn.cursor()
+                d = {'id': self.id}
+                cur.execute(ANONYMIZE_CASE, d)
+            finally:
+                db.recycleConnection(conn, cur)
+            state = self.getState()
+            state.setState(5)
+            return True
+        except:
+            traceback.print_exc(file=sys.stderr)
+        return False
+
+    def restore(self):
+        #If case has no EE then set EE to undefined on restore
+        ps = self.getPrivacyStatement()
+        if not ps.isSigned():
+            ps.keepUndefined()
+        self.getState().setState(1)
+
 class SessionCase:
 
     """This class holds all needed information for the currently selected case



More information about the Mpuls-commits mailing list