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

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


Author: bh
Date: 2010-07-02 20:40:53 +0200 (Fri, 02 Jul 2010)
New Revision: 3127

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/user.py
Log:
* mpulsweb/model/user.py (UserObject.store, UserObject.delete):
Use DB.execute to execute the database transactions


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-07-02 18:37:03 UTC (rev 3126)
+++ base/trunk/ChangeLog	2010-07-02 18:40:53 UTC (rev 3127)
@@ -1,5 +1,10 @@
 2010-07-02  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/user.py (UserObject.store, UserObject.delete):
+	Use DB.execute to execute the database transactions
+
+2010-07-02  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/model/user.py (UserGroup.delete, UserGroup.store): Use
 	DB.execute to execute the database transactions
 

Modified: base/trunk/mpulsweb/model/user.py
===================================================================
--- base/trunk/mpulsweb/model/user.py	2010-07-02 18:37:03 UTC (rev 3126)
+++ base/trunk/mpulsweb/model/user.py	2010-07-02 18:40:53 UTC (rev 3127)
@@ -585,25 +585,9 @@
         for key in fields.iterkeys():
             update_str.append('%s=%%(%s)s' % (key, key))
         fields['id'] = self.id
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            sql = STORE_USER_DATA_SQL % ", ".join(update_str)
-            cur.execute(sql, fields)
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
+        db.execute(STORE_USER_DATA_SQL % ", ".join(update_str), fields)
 
     def delete(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            fields = {'login': self.login, 'agency': self.agency}
-            cur.execute(DELETE_USER_SQL, fields)
-            conn.commit()
-            return True
-        finally:
-            db.recycleConnection(conn, cur)
-        return False
+        db.execute(DELETE_USER_SQL,
+                   {'login': self.login, 'agency': self.agency})
+        return True



More information about the Mpuls-commits mailing list