[Mpuls-commits] r4057 - base/trunk/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 28 10:11:08 CEST 2010


Author: torsten
Date: 2010-10-28 10:11:07 +0200 (Thu, 28 Oct 2010)
New Revision: 4057

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCase.checkValidity): Used get_db_parameters to get mapped db credentionals for setting up the db-connection in TagSetterconfig.


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2010-10-27 17:58:57 UTC (rev 4056)
+++ base/trunk/mpulsweb/model/case.py	2010-10-28 08:11:07 UTC (rev 4057)
@@ -51,7 +51,7 @@
 from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhase
 from mpulsweb.lib.helpers import ensure_unicode, format_date
 from mpulsweb.lib.db import PostgresDBInterface, db
-from mpulsweb.lib.security import getDbName
+from mpulsweb.lib.security import getDbName, get_db_parameters 
 
 from mpulsweb.model.document import listDocuments
 from mpulsweb.model.statement import PrivacyStatement
@@ -893,20 +893,22 @@
         """Check validity and set tags based on configuration in tagging.xml"""
 
         user = session['USER_AUTHORIZED']
-        host = config.get('mpuls.db.host')
-        port = config.get('mpuls.db.port')
-        db = config.get('mpuls.db.database')
-        db_user = config.get('mpuls.db.user')
-        db_name = getDbName()
+        db_parameters = get_db_parameters(getDbName(),
+                                          user.login, user.password,
+                                          config.get('mpuls.db.host'),
+                                          config.get('mpuls.db.port'),
+                                          config.get('mpuls.db.database'),
+                                          config.get('mpuls.db.user'))
 
         #TODO:
         # 1. Use established db-connection
         # 2. Do create (and parse config) a TagSetter every time.
         tagconfig = TagSetterConfig(g.taggingConfFile,
-                                    username=db_user % (db_name, user.login),
-                                    password=user.password,
-                                    database=db % db_name,
-                                    host=host, port=port,
+                                    username=db_parameters['user'],
+                                    password=db_parameters['password'],
+                                    database=db_parameters['database'],
+                                    host=db_parameters['host'], 
+                                    port=db_parameters['port'],
                                     caseid=self.id)
         setter = TagSetter(tagconfig)
 



More information about the Mpuls-commits mailing list