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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 2 16:26:01 CET 2011


Author: torsten
Date: 2011-11-02 16:26:01 +0100 (Wed, 02 Nov 2011)
New Revision: 5527

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
Changed method to check validity after saving a case. use get_TagSetter method
form lib/helpers now to get the TagSetter.


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-11-02 15:24:39 UTC (rev 5526)
+++ base/trunk/mpulsweb/model/case.py	2011-11-02 15:26:01 UTC (rev 5527)
@@ -46,14 +46,11 @@
 from formed.instance.backends.common import RuleEvalContext
 from formed.instance.tree import SetDataException
 
-from libmpuls.service.tags import TagSetterConfig, TagSetter
-
 from mpulsweb.lib.base import g, h, session
 from mpulsweb.lib.export import XLSExport, CSVExport
 from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhase
-from mpulsweb.lib.helpers import ensure_unicode, format_date
+from mpulsweb.lib.helpers import ensure_unicode, format_date, get_TagSetter
 from mpulsweb.lib.db import PostgresDBInterface, db
-from mpulsweb.lib.security import get_db_parameters
 
 from mpulsweb.model.document import listDocuments
 from mpulsweb.model.statement import PrivacyStatement
@@ -923,26 +920,7 @@
         """
         if not g.mpuls_config.is_enabled('case-module', 'checktags'):
             return
-
-        user = session['USER_AUTHORIZED']
-        db_parameters = get_db_parameters(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_parameters['user'],
-                                    password=db_parameters['password'],
-                                    database=db_parameters['database'],
-                                    host=db_parameters['host'],
-                                    port=db_parameters['port'],
-                                    caseid=None)
-        setter = TagSetter(tagconfig)
-
+        setter = get_TagSetter(session['USER_AUTHORIZED'], config)
         for caseid in caseids:
             log.debug('Tagging case: %s' % caseid)
             setter.perform(caseid)



More information about the Mpuls-commits mailing list