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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 23 16:23:01 CET 2010


Author: bh
Date: 2010-11-23 16:22:59 +0100 (Tue, 23 Nov 2010)
New Revision: 4249

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/base.py
   base/trunk/mpulsweb/lib/security.py
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/lib/security.py (get_db_parameters): Remove the first
parameter, dbagency.  It's always the unmapped db name currently
still returned by getDbName() anyway, so use that automatically
instead.

* mpulsweb/lib/base.py (BaseController.__before__),
mpulsweb/model/case.py (MpulsCase.checkValidity): Adapt to
get_db_parameters change


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-11-23 12:07:34 UTC (rev 4248)
+++ base/trunk/ChangeLog	2010-11-23 15:22:59 UTC (rev 4249)
@@ -1,3 +1,14 @@
+2010-11-23  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/security.py (get_db_parameters): Remove the first
+	parameter, dbagency.  It's always the unmapped db name currently
+	still returned by getDbName() anyway, so use that automatically
+	instead.
+
+	* mpulsweb/lib/base.py (BaseController.__before__),
+	mpulsweb/model/case.py (MpulsCase.checkValidity): Adapt to
+	get_db_parameters change
+
 2010-11-22  Roland Geider <roland.geider at intevation.de>
 
 	* mpulsweb/public/styles/all.css: issue1404: fix text color for

Modified: base/trunk/mpulsweb/lib/base.py
===================================================================
--- base/trunk/mpulsweb/lib/base.py	2010-11-23 12:07:34 UTC (rev 4248)
+++ base/trunk/mpulsweb/lib/base.py	2010-11-23 15:22:59 UTC (rev 4249)
@@ -167,8 +167,7 @@
         # If not then redirect the user to the login page
         try:
             user = session['USER_AUTHORIZED']
-            db_parameters = get_db_parameters(getDbName(),
-                                              user.login, user.password,
+            db_parameters = get_db_parameters(user.login, user.password,
                                               config.get('mpuls.db.host'),
                                               config.get('mpuls.db.port'),
                                               config.get('mpuls.db.database'),

Modified: base/trunk/mpulsweb/lib/security.py
===================================================================
--- base/trunk/mpulsweb/lib/security.py	2010-11-23 12:07:34 UTC (rev 4248)
+++ base/trunk/mpulsweb/lib/security.py	2010-11-23 15:22:59 UTC (rev 4249)
@@ -109,7 +109,7 @@
 
     log.info('Login: user "%s" in "%s"' % (user, dbname))
     try:
-        db_parameters = get_db_parameters(dbname, user, password,
+        db_parameters = get_db_parameters(user, password,
                                           config.get('mpuls.db.host'),
                                           config.get('mpuls.db.port'),
                                           config.get('mpuls.db.database'),
@@ -317,15 +317,11 @@
     return kaname
 
 
-def get_db_parameters(dbagency, login, password, host, port, dbtemplate,
-                      usertemplate):
+def get_db_parameters(login, password, host, port, dbtemplate, usertemplate):
     """Determine database connection parameters from user-specific information.
 
     Parameters:
 
-      dbagency -- identifier of the agency the user works for.  This
-                  will usually be determined by the getDbName function
-
       login, password -- Login name and corresponding password
 
       host, port -- Default host and portname of the database cluster
@@ -346,6 +342,7 @@
     user and password.  It can be used directly as a dictionary for the
     keyword parameter of a DB-API connect() call.
     """
+    dbagency = getDbName()
     mapping = g.mpuls_dbmapping.get_mapping()
     mapped_parameters = mapping.get(dbagency)
     if mapped_parameters:

Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2010-11-23 12:07:34 UTC (rev 4248)
+++ base/trunk/mpulsweb/model/case.py	2010-11-23 15:22:59 UTC (rev 4249)
@@ -893,8 +893,7 @@
         """Check validity and set tags based on configuration in tagging.xml"""
 
         user = session['USER_AUTHORIZED']
-        db_parameters = get_db_parameters(getDbName(),
-                                          user.login, user.password,
+        db_parameters = get_db_parameters(user.login, user.password,
                                           config.get('mpuls.db.host'),
                                           config.get('mpuls.db.port'),
                                           config.get('mpuls.db.database'),



More information about the Mpuls-commits mailing list