[Mpuls-commits] r3128 - in base/trunk: . mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jul 2 20:46:27 CEST 2010
Author: bh
Date: 2010-07-02 20:46:27 +0200 (Fri, 02 Jul 2010)
New Revision: 3128
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/model/user.py
Log:
* mpulsweb/model/user.py (UserObject.setNewsAsRead)
(UserObject.setStandin): Use DB.execute to execute the database
transactions
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-07-02 18:40:53 UTC (rev 3127)
+++ base/trunk/ChangeLog 2010-07-02 18:46:27 UTC (rev 3128)
@@ -1,5 +1,11 @@
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
+
+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
Modified: base/trunk/mpulsweb/model/user.py
===================================================================
--- base/trunk/mpulsweb/model/user.py 2010-07-02 18:40:53 UTC (rev 3127)
+++ base/trunk/mpulsweb/model/user.py 2010-07-02 18:46:27 UTC (rev 3128)
@@ -417,15 +417,7 @@
self._fetchData(id)
def setNewsAsRead(self, id):
- conn, cur = None, None
- try:
- conn = db.getConnection()
- cur = conn.cursor()
- fields = {'user_id': self.id, 'news_id': id}
- cur.execute(MARK_NEWS_AS_READ_SQL, fields)
- conn.commit()
- finally:
- db.recycleConnection(conn, cur)
+ db.execute(MARK_NEWS_AS_READ_SQL, {'user_id': self.id, 'news_id': id})
return 1
def setAdmUser(self):
@@ -497,17 +489,9 @@
db.recycleConnection(conn, cur)
def setStandin(self, gid):
- con, cur = None, None
- fields = {'userid': self.id, 'standin':gid}
- try:
- con = db.getConnection()
- cur = con.cursor()
- cur.execute(ALTER_USER_STANDIN_SQL, fields)
- con.commit()
- session['USER_AUTHORIZED'].standin = gid
- session.save()
- finally:
- db.recycleConnection(con, cur)
+ db.execute(ALTER_USER_STANDIN_SQL, {'userid': self.id, 'standin':gid})
+ session['USER_AUTHORIZED'].standin = gid
+ session.save()
def setData(self, data):
"""Set the user data from the dictionary data.
More information about the Mpuls-commits
mailing list