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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 7 13:33:41 CEST 2011


Author: bh
Date: 2011-07-07 13:33:40 +0200 (Thu, 07 Jul 2011)
New Revision: 5157

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/security.py
Log:
* mpulsweb/lib/security.py (get_dbname_from_list)
(get_dbname_from_session): Rename get_dbname_from_list to
get_dbname_from_session to make it clearer what the function
does. The db name in this case does not always come from an option
list from an HTML form, for instance it doesn't in the AiR meta API.
(get_unmapped_db_name): Adapt to rename.
(store_dbname_in_session): Adapt doc-string to rename


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-07-07 10:33:14 UTC (rev 5156)
+++ base/trunk/ChangeLog	2011-07-07 11:33:40 UTC (rev 5157)
@@ -1,5 +1,15 @@
 2011-07-07  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/security.py (get_dbname_from_list)
+	(get_dbname_from_session): Rename get_dbname_from_list to
+	get_dbname_from_session to make it clearer what the function
+	does. The db name in this case does not always come from an option
+	list from an HTML form, for instance it doesn't in the AiR meta API.
+	(get_unmapped_db_name): Adapt to rename.
+	(store_dbname_in_session): Adapt doc-string to rename
+
+2011-07-07  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/auth.py (AuthController.loginAction): Use
 	store_dbname_in_session so store the db name selected by the user
 	in the session instead of accessing the session directly.

Modified: base/trunk/mpulsweb/lib/security.py
===================================================================
--- base/trunk/mpulsweb/lib/security.py	2011-07-07 10:33:14 UTC (rev 5156)
+++ base/trunk/mpulsweb/lib/security.py	2011-07-07 11:33:40 UTC (rev 5157)
@@ -225,14 +225,16 @@
     """
     return config.get('mpuls.db.name')
 
-def get_dbname_from_list():
-    """Return the name of the database name from the saved db name in the
-    session. The session var gets set in the login-method of the auth controller."""
-    return session.get('DB_NAME_FROM_LIST')
+def get_dbname_from_session():
+    """Return the KA-specific part of the database name from the session.
+    If it's not available in the session, the function returns None. The
+    value should be stored in the session with store_dbname_in_session.
+    """
+    return session.get("DB_NAME_FROM_LIST")
 
 def store_dbname_in_session(dbname):
     """Store the KA-specific part of the database name in the session.
-    The value can be retrieved again with get_dbname_from_list. It is
+    The value can be retrieved again with get_dbname_from_session. It is
     intended to be used if the name has to be determined by the
     application using a method not covered by get_unmapped_db_name. The
     application should call store_dbname_in_session before calling
@@ -249,7 +251,7 @@
     those headers are not set, the value is taken from the configuration using
     get_dbname_from_config().
     """
-    dbname = get_dbname_from_list()
+    dbname = get_dbname_from_session()
     if not dbname:
         log.debug("Could not determine database name from Request params,"
                  " falling back to HTTP header ")



More information about the Mpuls-commits mailing list