[Mpuls-commits] r3123 - in base/trunk: . mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 2 20:13:04 CEST 2010


Author: bh
Date: 2010-07-02 20:13:03 +0200 (Fri, 02 Jul 2010)
New Revision: 3123

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/statement.py
Log:
* mpulsweb/model/statement.py (PrivacyStatement.sign)
(PrivacyStatement.keepUndefined, PrivacyStatement.decline): Use
DB.execute to execute the database transactions


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-07-02 18:06:06 UTC (rev 3122)
+++ base/trunk/ChangeLog	2010-07-02 18:13:03 UTC (rev 3123)
@@ -1,5 +1,11 @@
 2010-07-02  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/statement.py (PrivacyStatement.sign)
+	(PrivacyStatement.keepUndefined, PrivacyStatement.decline): Use
+	DB.execute to execute the database transactions
+
+2010-07-02  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/security.py (checkLogin): Use DB.execute to execute
 	the UPDATE_LASTLOGIN_SQL statement
 

Modified: base/trunk/mpulsweb/model/statement.py
===================================================================
--- base/trunk/mpulsweb/model/statement.py	2010-07-02 18:06:06 UTC (rev 3122)
+++ base/trunk/mpulsweb/model/statement.py	2010-07-02 18:13:03 UTC (rev 3123)
@@ -79,37 +79,13 @@
         return Template(self.agency.getPrivacyStatement()).safe_substitute(s)
 
     def sign(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(SET_STATEMENT_FLAG_SQL,
-                        {'id': self.case.id, 'value': 1})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
+        db.execute(SET_STATEMENT_FLAG_SQL, {'id': self.case.id, 'value': 1})
 
     def keepUndefined(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(SET_STATEMENT_FLAG_SQL,
-                        {'id': self.case.id, 'value': -1})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
+        db.execute(SET_STATEMENT_FLAG_SQL, {'id': self.case.id, 'value': -1})
 
     def decline(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(SET_STATEMENT_FLAG_SQL,
-                        {'id': self.case.id, 'value': 0})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
+        db.execute(SET_STATEMENT_FLAG_SQL, {'id': self.case.id, 'value': 0})
 
     def isSigned(self):
         '''Returns True is teh statement is signed. False if the statement is



More information about the Mpuls-commits mailing list