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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 19 08:49:09 CET 2010


Author: torsten
Date: 2010-03-19 08:49:09 +0100 (Fri, 19 Mar 2010)
New Revision: 2025

Modified:
   wasko/branches/2.0/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCase.delete): New. Copied from
  jmdweb.


Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py	2010-03-19 07:47:51 UTC (rev 2024)
+++ wasko/branches/2.0/mpulsweb/model/case.py	2010-03-19 07:49:09 UTC (rev 2025)
@@ -59,6 +59,7 @@
 SELECT create_nm_benutzer_master_ds(%(groupid)s, %(caseid)s)"""
 DELETE_STANDIN_SQL = """
 SELECT delete_nm_benutzer_master_ds(%(groupid)s, %(caseid)s)"""
+DELETE_CASE_SQL = """select delete_master_ds(%(id)s)"""
 
 #DIALOGS
 MARKANONYMIZE_FAILED_MIN_PHASE = u"""\
@@ -396,10 +397,6 @@
         finally:
             db.recycleConnection(con, cur)
 
-
-
-
-
 class MpulsCase:
 
     def __init__(self, id=None, preset=None):
@@ -609,6 +606,22 @@
             raise
         return None
 
+    def delete(self):
+        """Deletes the case from data base. Returns True if deletion succseeds
+        """
+        conn, cur = None, None
+        try:
+            conn = db.getConnection()
+            cur = conn.cursor()
+            cur.execute(DELETE_CASE_SQL, {'id': self.id})
+            conn.commit()
+            return True
+        except Exception, e:
+            log.exception(e)
+        finally:
+            db.recycleConnection(conn, cur)
+        return False
+
 class MpulsCaseFactory:
 
     """Factory for case object. This factory provides methods to either load



More information about the Mpuls-commits mailing list