[Mpuls-commits] r3498 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 31 20:38:26 CEST 2010


Author: bh
Date: 2010-08-31 20:38:25 +0200 (Tue, 31 Aug 2010)
New Revision: 3498

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/search.py
Log:
* mpulsweb/lib/search.py (CaseSearch.get_phases_clause): Use
generic_int_choice_clause instead of having the equivalent code
inline.  Actually it's not completely equivalent: if "phase" is
not in the options dictionary, the method returns 'TRUE' now
instead of 'FALSE' as before.  This shouldn't be a problem for
mpuls though, and the phase option is handled like the other
choice options now.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-08-31 18:37:13 UTC (rev 3497)
+++ base/trunk/ChangeLog	2010-08-31 18:38:25 UTC (rev 3498)
@@ -1,5 +1,15 @@
 2010-08-31  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/search.py (CaseSearch.get_phases_clause): Use
+	generic_int_choice_clause instead of having the equivalent code
+	inline.  Actually it's not completely equivalent: if "phase" is
+	not in the options dictionary, the method returns 'TRUE' now
+	instead of 'FALSE' as before.  This shouldn't be a problem for
+	mpuls though, and the phase option is handled like the other
+	choice options now.
+
+2010-08-31  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/search.py (CaseSearch.generic_int_choice_clause):
 	New.  More generic way to handle a common case of search SQL
 	subclause

Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py	2010-08-31 18:37:13 UTC (rev 3497)
+++ base/trunk/mpulsweb/lib/search.py	2010-08-31 18:38:25 UTC (rev 3498)
@@ -323,10 +323,7 @@
 
         Derived classes may override this method if necessary.
         """
-        if options.get("phase", ()):
-            return ('m.phase IN (%s)'
-                    % ','.join([str(p) for p in options["phase"]]))
-        return "FALSE"
+        return self.generic_int_choice_clause(options, "phase", "m.phase")
 
     def get_needle_clause(self, options):
         """Return the search condition to select cases based on search terms.



More information about the Mpuls-commits mailing list