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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 3 17:11:17 CET 2011


Author: bh
Date: 2011-02-03 17:11:15 +0100 (Thu, 03 Feb 2011)
New Revision: 4564

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCase.check_validity_for_ids):
Rename check_validity_for_id to check_validity_for_ids and make
the parameter a sequence of case ids so that multiple cases can be
tagged at once without having to reload the tagging config.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-02-03 15:53:53 UTC (rev 4563)
+++ base/trunk/ChangeLog	2011-02-03 16:11:15 UTC (rev 4564)
@@ -1,5 +1,12 @@
 2011-02-03  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/case.py (MpulsCase.check_validity_for_ids):
+	Rename check_validity_for_id to check_validity_for_ids and make
+	the parameter a sequence of case ids so that multiple cases can be
+	tagged at once without having to reload the tagging config.
+
+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

Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-02-03 15:53:53 UTC (rev 4563)
+++ base/trunk/mpulsweb/model/case.py	2011-02-03 16:11:15 UTC (rev 4564)
@@ -892,11 +892,12 @@
 
     def checkValidity(self):
         """Check validity and set tags based on configuration in tagging.xml"""
-        self.check_validity_for_id(self.id)
+        self.check_validity_for_ids([self.id])
 
     @classmethod
-    def check_validity_for_id(cls, caseid):
-        """Check validitiy for the dataset given by caseid"""
+    def check_validity_for_ids(cls, caseids):
+        """Check validitiy for the datasets for the ids in the sequence caseids
+        """
         if not g.mpuls_config.is_enabled('case-module', 'checktags'):
             return
 
@@ -916,11 +917,12 @@
                                     database=db_parameters['database'],
                                     host=db_parameters['host'],
                                     port=db_parameters['port'],
-                                    caseid=caseid)
+                                    caseid=None)
         setter = TagSetter(tagconfig)
 
-        log.debug('Tagging case: %s' % caseid)
-        setter.perform(caseid)
+        for caseid in caseids:
+            log.debug('merge 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