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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 3 16:23:25 CET 2011


Author: bh
Date: 2011-02-03 16:23:23 +0100 (Thu, 03 Feb 2011)
New Revision: 4562

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCase.checkValidity): Exit early
when tagging is disabled. There's no need to create a TagSetter
object at all in that case.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-02-03 09:48:12 UTC (rev 4561)
+++ base/trunk/ChangeLog	2011-02-03 15:23:23 UTC (rev 4562)
@@ -1,3 +1,9 @@
+2011-02-03  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/model/case.py (MpulsCase.checkValidity): Exit early
+	when tagging is disabled. There's no need to create a TagSetter
+	object at all in that case.
+
 2011-02-03  Torsten Irlaender <torsten at intevation.de>
 
 	* mpulsweb/controllers/case.py: Fixed Imports. Added missing import of

Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-02-03 09:48:12 UTC (rev 4561)
+++ base/trunk/mpulsweb/model/case.py	2011-02-03 15:23:23 UTC (rev 4562)
@@ -892,6 +892,8 @@
 
     def checkValidity(self):
         """Check validity and set tags based on configuration in tagging.xml"""
+        if not g.mpuls_config.is_enabled('case-module', 'checktags'):
+            return
 
         user = session['USER_AUTHORIZED']
         db_parameters = get_db_parameters(user.login, user.password,
@@ -907,14 +909,13 @@
                                     username=db_parameters['user'],
                                     password=db_parameters['password'],
                                     database=db_parameters['database'],
-                                    host=db_parameters['host'], 
+                                    host=db_parameters['host'],
                                     port=db_parameters['port'],
                                     caseid=self.id)
         setter = TagSetter(tagconfig)
 
-        if g.mpuls_config.is_enabled ('case-module', 'checktags'):
-            log.debug('Tagging case: %s' % self.id)
-            setter.perform(self.id)
+        log.debug('Tagging case: %s' % self.id)
+        setter.perform(self.id)
 
     def getValidity(self):
         '''Will return the id of the max validity based on set tags'''



More information about the Mpuls-commits mailing list