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

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


Author: bh
Date: 2010-07-02 20:23:27 +0200 (Fri, 02 Jul 2010)
New Revision: 3124

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/logbook.py
Log:
* mpulsweb/model/logbook.py (LogbookEntry.storeForUser)
(Logbook.deleteEntryById): Use DB.execute to execute the database
transactions


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-07-02 18:13:03 UTC (rev 3123)
+++ base/trunk/ChangeLog	2010-07-02 18:23:27 UTC (rev 3124)
@@ -1,5 +1,11 @@
 2010-07-02  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/logbook.py (LogbookEntry.storeForUser)
+	(Logbook.deleteEntryById): Use DB.execute to execute the database
+	transactions
+
+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

Modified: base/trunk/mpulsweb/model/logbook.py
===================================================================
--- base/trunk/mpulsweb/model/logbook.py	2010-07-02 18:13:03 UTC (rev 3123)
+++ base/trunk/mpulsweb/model/logbook.py	2010-07-02 18:23:27 UTC (rev 3124)
@@ -198,20 +198,13 @@
                      "id": self.id})
 
     def storeForUser(self, uid):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(UPDATE_LOGBOOK_ENTRY,
-                        {"date": self.datum,
-                         "kind": self.art,
-                         "short_notice": self.kurz_notiz,
-                         "notice": self.notiz,
-                         "duration": self.dauer,
-                         "id": self.id})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
+        db.execute(UPDATE_LOGBOOK_ENTRY,
+                   {"date": self.datum,
+                    "kind": self.art,
+                    "short_notice": self.kurz_notiz,
+                    "notice": self.notiz,
+                    "duration": self.dauer,
+                    "id": self.id})
 
 
 class Logbook:
@@ -223,14 +216,7 @@
         self.sort_order = sort_order
 
     def deleteEntryById(self, mid):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(DELETE_LOGBOOK_ENTRY, {'mid': mid})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
+        db.execute(DELETE_LOGBOOK_ENTRY, {'mid': mid})
 
     def loadById(self, mid, sort_field='datum', sort_order='desc'):
         self.mid = mid



More information about the Mpuls-commits mailing list