[Mpuls-commits] r6136 - base/trunk/mpulsweb/lib

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 2 15:38:08 CET 2012


Author: torsten
Date: 2012-11-02 15:38:08 +0100 (Fri, 02 Nov 2012)
New Revision: 6136

Modified:
   base/trunk/mpulsweb/lib/search.py
Log:
Fixed extended search. The phase -1 (unknow) was completly ignored. So the
search failed for cases with phase unknown even if the user provides to search
for those cases in the search options.


Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py	2012-11-01 16:02:21 UTC (rev 6135)
+++ base/trunk/mpulsweb/lib/search.py	2012-11-02 14:38:08 UTC (rev 6136)
@@ -408,7 +408,7 @@
             # no date range given -> match according to current phase
             return self.generic_int_choice_clause(options, "phase", "m.phase")
 
-        phases = options.get('phase')
+        phases = options.get('phase', [])
         phase_clauses = []
         phase_list = PhaseFactory().build()
         for p in phase_list:
@@ -440,6 +440,12 @@
                                      % (sp.datefield, sp.datefield, ed,
                                         ep.datefield, sd,
                                         ",".join(str(s) for s in successors)))
+
+        # If phases includes -1 then add check for cases with unknown
+        # phase.
+        if -1 in phases:
+            phase_clauses.append("(phase in (-1))")
+
         if phase_clauses:
             return "(%s)" % " OR ".join(phase_clauses)
         return "FALSE"



More information about the Mpuls-commits mailing list