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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 2 21:26:06 CEST 2010


Author: bh
Date: 2010-07-02 21:26:05 +0200 (Fri, 02 Jul 2010)
New Revision: 3133

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCaseState.setState)
(MpulsCaseState.setPhase): Use DB.execute to execute the database
transactions


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-07-02 19:23:44 UTC (rev 3132)
+++ base/trunk/ChangeLog	2010-07-02 19:26:05 UTC (rev 3133)
@@ -1,5 +1,11 @@
 2010-07-02  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/case.py (MpulsCaseState.setState)
+	(MpulsCaseState.setPhase): Use DB.execute to execute the database
+	transactions
+
+2010-07-02  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/model/case.py (MpulsCaseState.setPhase): Use
 	log.exception instead of printing a traceback directly to stderr.
 

Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2010-07-02 19:23:44 UTC (rev 3132)
+++ base/trunk/mpulsweb/model/case.py	2010-07-02 19:26:05 UTC (rev 3133)
@@ -1165,17 +1165,9 @@
         return self.state
 
     def setState(self, value):
-        conn, cur = None, None
         try:
-            try:
-                conn = db.getConnection()
-                cur = conn.cursor()
-                fields = {'status': value, 'id': self.id}
-                cur.execute(SET_CASESTATE_SQL, fields)
-                conn.commit()
-                self.state = value
-            finally:
-                db.recycleConnection(conn, cur)
+            db.execute(SET_CASESTATE_SQL, {'status': value, 'id': self.id})
+            self.state = value
             return True
         except:
             log.exception("Error while setting state of case %d"
@@ -1186,17 +1178,9 @@
         return self.phase
 
     def setPhase(self, phase):
-        conn, cur = None, None
         try:
-            try:
-                conn = db.getConnection()
-                cur = conn.cursor()
-                fields = {'phase': phase, 'id': self.id}
-                cur.execute(SET_CASEPHASE_SQL, fields)
-                conn.commit()
-                self.phase = phase
-            finally:
-                db.recycleConnection(conn, cur)
+            db.execute(SET_CASEPHASE_SQL, {'phase': phase, 'id': self.id})
+            self.phase = phase
             return True
         except:
             log.exception("Error while setting phase of case %r to %r"



More information about the Mpuls-commits mailing list