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

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


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

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


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-07-02 18:28:03 UTC (rev 3125)
+++ base/trunk/ChangeLog	2010-07-02 18:37:03 UTC (rev 3126)
@@ -1,5 +1,10 @@
 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
+
+2010-07-02  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/model/user.py (UserGroup.delete): Fix exception log
 	message
 

Modified: base/trunk/mpulsweb/model/user.py
===================================================================
--- base/trunk/mpulsweb/model/user.py	2010-07-02 18:28:03 UTC (rev 3125)
+++ base/trunk/mpulsweb/model/user.py	2010-07-02 18:37:03 UTC (rev 3126)
@@ -235,30 +235,15 @@
     def delete(self):
         '''Deletes the usergroup object from the database'''
         try:
-            conn, cur = None, None
-            fields = {'id': self.id}
-            try:
-                conn = db.getConnection()
-                cur = conn.cursor()
-                cur.execute(DELETE_USERGROUP_DATA_SQL, fields)
-                conn.commit()
-            finally:
-                db.recycleConnection(conn, cur)
+            db.execute(DELETE_USERGROUP_DATA_SQL, {'id': self.id})
         except StandardError, err:
             log.exception("Error while deleting usergroup")
 
     def store(self):
         '''Stores the data the usergroup object in the database (UPDATE)'''
         try:
-            conn, cur = None, None
-            fields = {'id': self.id, 'name': self.name}
-            try:
-                conn = db.getConnection()
-                cur = conn.cursor()
-                cur.execute(STORE_USERGROUP_DATA_SQL, fields)
-                conn.commit()
-            finally:
-                db.recycleConnection(conn, cur)
+            db.execute(STORE_USERGROUP_DATA_SQL,
+                       {'id': self.id, 'name': self.name})
         except StandardError, err:
             log.exception("Error while creating usergroup")
 



More information about the Mpuls-commits mailing list