[Mpuls-commits] r464 - in wasko/trunk: . waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 2 16:47:45 CEST 2009


Author: teichmann
Date: 2009-04-02 16:47:38 +0200 (Thu, 02 Apr 2009)
New Revision: 464

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/model/casexml.py
Log:
Fixed issue149


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-04-02 13:58:28 UTC (rev 463)
+++ wasko/trunk/ChangeLog.txt	2009-04-02 14:47:38 UTC (rev 464)
@@ -1,3 +1,10 @@
+2009-04-02	Sascha L. Teichmann <teichmann at intevation.de>
+
+	Fixed issue149 (application part)
+
+	* waskaweb/model/casexml.py: Check uuid for being already anonymized before
+	  importing the case.
+
 2009-04-02	Torsten Irlaender  <torsten.irlaender at intevation.de> 
 
 	Fixed issue151:

Modified: wasko/trunk/waskaweb/model/casexml.py
===================================================================
--- wasko/trunk/waskaweb/model/casexml.py	2009-04-02 13:58:28 UTC (rev 463)
+++ wasko/trunk/waskaweb/model/casexml.py	2009-04-02 14:47:38 UTC (rev 464)
@@ -50,6 +50,9 @@
 
 UUID_RE = re.compile(r"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
 
+SQL_IS_ANONYMIZED_UUID = \
+"""SELECT is_uuid_anonymized(%(uuid)s)"""
+
 SQL_GET_MASTER_ID = \
 """SELECT get_masterid_from_uuid(%(relation_name)s, %(uuid)s)"""
 
@@ -89,6 +92,12 @@
 def is_uuid(s):
     return bool(UUID_RE.match(s))
 
+def is_uuid_anonymized(cur, uuid):
+    cur.execute(SQL_IS_ANONYMIZED_UUID, { 'uuid': uuid })
+    row = cur.fetchone()
+    if not row: return False
+    return row[0]
+
 def get_logbuch_ids_from_uuid(cur, uuid_id):
     cur.execute(SQL_SELECT_IDS_FROM_LOGBOOK, { 'uuid_id': uuid_id  })
     return cur.fetchone()
@@ -389,6 +398,12 @@
 
         if self.uuid:
             #print >> sys.stderr, "found uuid '%s'" % repr(master_handler.uuid)
+
+            if is_uuid_anonymized(self.cur, self.uuid):
+                raise XMLImportException(
+                    u"Die Fallakte wurde auf dem zentralen Server bereits anonymisiert. "
+                    u"Ein Import ist daher nicht mehr möglich.")
+
             ds_id = get_id_for_uuid(self.cur, 'master', self.uuid)
             if not ds_id is None:
                 #print >> sys.stderr, "case %d already exists" % ds_id



More information about the Mpuls-commits mailing list