diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-05 14:13:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-12 00:01:48 +0100 |
commit | 51ae1de5b75b6f831b46433b2e36c6112d1a0c59 (patch) | |
tree | e94d54d469089e1e5ee334769c7eca6e1aaa5398 /bitbake | |
parent | c941743c9a1310c1b5ef942fa6e6d1ed31a7faa7 (diff) | |
download | poky-51ae1de5b75b6f831b46433b2e36c6112d1a0c59.tar.gz |
bitbake: toaster: toastertables raise errors
Modifies the widget code to raise the Exceptions to the user
instead of printing then to stdout - making the programming
errors much more visible.
(Bitbake rev: 26dc19284e06a7ae35f75a243b2062f61e30f2ca)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/widgets.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index 407a0fbe15..3d3c1d10df 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py | |||
@@ -207,7 +207,8 @@ class ToasterTable(TemplateView): | |||
207 | try: | 207 | try: |
208 | self.filter_actions[filter_action]() | 208 | self.filter_actions[filter_action]() |
209 | except KeyError: | 209 | except KeyError: |
210 | print "Filter and Filter action pair not found" | 210 | # pass it to the user - programming error here |
211 | raise | ||
211 | 212 | ||
212 | def apply_orderby(self, orderby): | 213 | def apply_orderby(self, orderby): |
213 | # Note that django will execute this when we try to retrieve the data | 214 | # Note that django will execute this when we try to retrieve the data |
@@ -217,8 +218,7 @@ class ToasterTable(TemplateView): | |||
217 | """Creates a query based on the model's search_allowed_fields""" | 218 | """Creates a query based on the model's search_allowed_fields""" |
218 | 219 | ||
219 | if not hasattr(self.queryset.model, 'search_allowed_fields'): | 220 | if not hasattr(self.queryset.model, 'search_allowed_fields'): |
220 | print "Err Search fields aren't defined in the model" | 221 | raise Exception("Err Search fields aren't defined in the model") |
221 | return | ||
222 | 222 | ||
223 | search_queries = [] | 223 | search_queries = [] |
224 | for st in search_term.split(" "): | 224 | for st in search_term.split(" "): |
@@ -228,9 +228,10 @@ class ToasterTable(TemplateView): | |||
228 | search_queries.append(reduce(operator.or_, q_map)) | 228 | search_queries.append(reduce(operator.or_, q_map)) |
229 | 229 | ||
230 | search_queries = reduce(operator.and_, search_queries) | 230 | search_queries = reduce(operator.and_, search_queries) |
231 | print "applied the search to the queryset" | 231 | |
232 | self.queryset = self.queryset.filter(search_queries) | 232 | self.queryset = self.queryset.filter(search_queries) |
233 | 233 | ||
234 | |||
234 | def get_data(self, request, **kwargs): | 235 | def get_data(self, request, **kwargs): |
235 | """Returns the data for the page requested with the specified | 236 | """Returns the data for the page requested with the specified |
236 | parameters applied""" | 237 | parameters applied""" |
@@ -318,7 +319,8 @@ class ToasterTable(TemplateView): | |||
318 | data['rows'].append(required_data) | 319 | data['rows'].append(required_data) |
319 | 320 | ||
320 | except FieldError: | 321 | except FieldError: |
321 | print "Error: Requested field does not exist" | 322 | # pass it to the user - programming-error here |
323 | raise | ||
322 | data = json.dumps(data, indent=2, default=objtojson) | 324 | data = json.dumps(data, indent=2, default=objtojson) |
323 | cache.set(cache_name, data, 60*30) | 325 | cache.set(cache_name, data, 60*30) |
324 | 326 | ||