summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-04-08 16:10:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-09 17:00:01 +0100
commitf88a3437734f4f6559d391415089bf571152f63d (patch)
tree5bc94a4e76fa401da96232da68f623a38ac2b9ad /bitbake/lib/toaster/toastergui/views.py
parentb14482ef611d166b5f158cede371f73c26e2a937 (diff)
downloadpoky-f88a3437734f4f6559d391415089bf571152f63d.tar.gz
bitbake: toaster: fix filtering query for multiple filters
This is a fix for using multiple expressions in filters. Three different issues are touched: * added an explicit error message for incorrect filter usage * changed the value separator to something that will pass through from the browser to the actual code * changed the "and" operator for combining Q from a dubios lambda function to the standard operator.and_ (Bitbake rev: 845b081fc108c656f04d4a70afa4695defc13c9f) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rw-r--r--bitbake/lib/toaster/toastergui/views.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 96ce4d7fcf..4ed99400c8 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -80,7 +80,7 @@ def _redirect_parameters(view, g, mandatory_parameters, *args, **kwargs):
80 return redirect(url + "?%s" % urllib.urlencode(params), *args, **kwargs) 80 return redirect(url + "?%s" % urllib.urlencode(params), *args, **kwargs)
81 81
82FIELD_SEPARATOR = ":" 82FIELD_SEPARATOR = ":"
83VALUE_SEPARATOR = ";" 83VALUE_SEPARATOR = "!"
84DESCENDING = "-" 84DESCENDING = "-"
85 85
86def __get_q_for_val(name, value): 86def __get_q_for_val(name, value):
@@ -102,7 +102,7 @@ def _get_filtering_query(filter_string):
102 values = search_terms[1].split(VALUE_SEPARATOR) 102 values = search_terms[1].split(VALUE_SEPARATOR)
103 103
104 querydict = dict(zip(keys, values)) 104 querydict = dict(zip(keys, values))
105 return reduce(lambda x, y: x & y, map(lambda x: __get_q_for_val(k, querydict[k]),[k for k in querydict])) 105 return reduce(operator.and_, map(lambda x: __get_q_for_val(x, querydict[x]), [k for k in querydict]))
106 106
107def _get_toggle_order(request, orderkey, reverse = False): 107def _get_toggle_order(request, orderkey, reverse = False):
108 if reverse: 108 if reverse:
@@ -128,7 +128,7 @@ def _validate_input(input, model):
128 128
129 # Check we have only one colon 129 # Check we have only one colon
130 if len(input_list) != 2: 130 if len(input_list) != 2:
131 invalid = "We have an invalid number of separators" 131 invalid = "We have an invalid number of separators: " + input + " -> " + str(input_list)
132 return None, invalid 132 return None, invalid
133 133
134 # Check we have an equal number of terms both sides of the colon 134 # Check we have an equal number of terms both sides of the colon