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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Aug 13 20:41:25 CEST 2010


Author: bh
Date: 2010-08-13 20:41:23 +0200 (Fri, 13 Aug 2010)
New Revision: 3411

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/search.py
Log:
* mpulsweb/lib/search.py (CaseSearch.get_phases_clause): Simplify
the SQL expression substantially (there's no need for a subquery
here at all) and simplify the python code a little.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-08-13 18:37:34 UTC (rev 3410)
+++ base/trunk/ChangeLog	2010-08-13 18:41:23 UTC (rev 3411)
@@ -1,5 +1,11 @@
 2010-08-13  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/search.py (CaseSearch.get_phases_clause): Simplify
+	the SQL expression substantially (there's no need for a subquery
+	here at all) and simplify the python code a little.
+
+2010-08-13  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/search.py (CaseSearch.get_needle_clause): Refactor
 	to simplify the logic a little and generate a simple "TRUE" if no
 	search terms were given by the user.

Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py	2010-08-13 18:37:34 UTC (rev 3410)
+++ base/trunk/mpulsweb/lib/search.py	2010-08-13 18:41:23 UTC (rev 3411)
@@ -166,12 +166,9 @@
 
         Derived classes may override this method if necessary.
         """
-        phases = 'FALSE' #default
         if phaseslist:
-            phases = ('m.id in'
-                      ' (SELECT id from master_tbl_view WHERE phase IN (%s))'
-                      % ','.join([str(p) for p in phaseslist]))
-        return phases
+            return 'm.phase IN (%s)' % ','.join([str(p) for p in phaseslist])
+        return "FALSE"
 
     def get_needle_clause(self, options, search):
         """Return the search condition to select cases based on search terms.



More information about the Mpuls-commits mailing list