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

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


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

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCase.check_validity_for_id)
(MpulsCase.checkValidity): Move the actual functionality of
checkValidity into the new class method check_validity_for_id so
that it can be used without having to instantiate a case object.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-02-03 15:23:23 UTC (rev 4562)
+++ base/trunk/ChangeLog	2011-02-03 15:53:53 UTC (rev 4563)
@@ -1,5 +1,12 @@
 2011-02-03  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/case.py (MpulsCase.check_validity_for_id)
+	(MpulsCase.checkValidity): Move the actual functionality of
+	checkValidity into the new class method check_validity_for_id so
+	that it can be used without having to instantiate a case object.
+
+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.

Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-02-03 15:23:23 UTC (rev 4562)
+++ base/trunk/mpulsweb/model/case.py	2011-02-03 15:53:53 UTC (rev 4563)
@@ -892,6 +892,11 @@
 
     def checkValidity(self):
         """Check validity and set tags based on configuration in tagging.xml"""
+        self.check_validity_for_id(self.id)
+
+    @classmethod
+    def check_validity_for_id(cls, caseid):
+        """Check validitiy for the dataset given by caseid"""
         if not g.mpuls_config.is_enabled('case-module', 'checktags'):
             return
 
@@ -911,11 +916,11 @@
                                     database=db_parameters['database'],
                                     host=db_parameters['host'],
                                     port=db_parameters['port'],
-                                    caseid=self.id)
+                                    caseid=caseid)
         setter = TagSetter(tagconfig)
 
-        log.debug('Tagging case: %s' % self.id)
-        setter.perform(self.id)
+        log.debug('Tagging case: %s' % caseid)
+        setter.perform(caseid)
 
     def getValidity(self):
         '''Will return the id of the max validity based on set tags'''



More information about the Mpuls-commits mailing list