[Mpuls-commits] r5184 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 20 16:19:47 CEST 2011


Author: bh
Date: 2011-07-20 16:19:46 +0200 (Wed, 20 Jul 2011)
New Revision: 5184

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/base.py
Log:
* mpulsweb/lib/base.py (BaseController.__before__): Store the
database name used by the current user in the DBNameContextFilter
(BaseController.__call__): Reset the database name again after the
request.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-07-20 14:18:14 UTC (rev 5183)
+++ base/trunk/ChangeLog	2011-07-20 14:19:46 UTC (rev 5184)
@@ -1,5 +1,12 @@
 2011-07-20  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/base.py (BaseController.__before__): Store the
+	database name used by the current user in the DBNameContextFilter
+	(BaseController.__call__): Reset the database name again after the
+	request.
+
+2011-07-20  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/logfilter.py (DBNameContextFilter): Rework how the
 	database name is determined. Using getDbName is problematic, since
 	it may use the logging framework itself. Now, the

Modified: base/trunk/mpulsweb/lib/base.py
===================================================================
--- base/trunk/mpulsweb/lib/base.py	2011-07-20 14:18:14 UTC (rev 5183)
+++ base/trunk/mpulsweb/lib/base.py	2011-07-20 14:19:46 UTC (rev 5184)
@@ -52,6 +52,7 @@
 from mpulsweb.lib.timelog import timeLog
 from mpulsweb.lib.navigation import get_navigation
 from mpulsweb.lib.app_globals import session
+from mpulsweb.lib.logfilter import DBNameContextFilter
 import mpulsweb.lib.helpers as h
 from mpulsweb.lib.security import userIdentity, get_db_parameters
 
@@ -167,6 +168,8 @@
         # If not then redirect the user to the login page
         try:
             user = session['USER_AUTHORIZED']
+            DBNameContextFilter.set_thread_dbname(user.agency)
+
             db_parameters = get_db_parameters(user.login, user.password,
                                               config.get('mpuls.db.host'),
                                               config.get('mpuls.db.port'),
@@ -213,6 +216,7 @@
                 self.db = None
                 db.leave(_db)
                 _db.closeConnections()
+            DBNameContextFilter.set_thread_dbname(None)
             stopTime = time()
             timeLog(stopTime - startTime)
 



More information about the Mpuls-commits mailing list