[Mpuls-commits] r3129 - in base/trunk: . mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jul 2 20:48:32 CEST 2010
Author: bh
Date: 2010-07-02 20:48:31 +0200 (Fri, 02 Jul 2010)
New Revision: 3129
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/model/document.py
Log:
* mpulsweb/model/document.py (deleteDocument): Use DB.execute to
execute the database transactions
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-07-02 18:46:27 UTC (rev 3128)
+++ base/trunk/ChangeLog 2010-07-02 18:48:31 UTC (rev 3129)
@@ -1,5 +1,10 @@
2010-07-02 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/model/document.py (deleteDocument): Use DB.execute to
+ execute the database transactions
+
+2010-07-02 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/model/user.py (UserObject.setNewsAsRead)
(UserObject.setStandin): Use DB.execute to execute the database
transactions
Modified: base/trunk/mpulsweb/model/document.py
===================================================================
--- base/trunk/mpulsweb/model/document.py 2010-07-02 18:46:27 UTC (rev 3128)
+++ base/trunk/mpulsweb/model/document.py 2010-07-02 18:48:31 UTC (rev 3129)
@@ -125,27 +125,13 @@
def deleteDocument(id, case=False):
id = int(id)
- has_commited = False
- con, cur = None, None
- try:
- con = db.getConnection()
- cur = con.cursor()
- if case:
- cur.execute(DELETE_CASE, {'id': id})
- else:
- cur.execute(DELETE_GLOBAL, {'id': id})
- con.commit()
- has_commited = True
- finally:
- if not has_commited and con:
- try:
- con.rollback()
- except:
- pass
+ if case:
+ statement = DELETE_CASE
+ else:
+ statement = DELETE_GLOBAL
+ db.execute(statement, {'id': id})
- db.recycleConnection(con, cur)
-
class Document:
def __init__(self, id=None, case=None, size=None, mime=None, name=None):
More information about the Mpuls-commits
mailing list