diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-03 15:18:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-12 00:01:48 +0100 |
commit | b1c91d06e0262e886154129fb1b6b4a12e3fc5fe (patch) | |
tree | 7648a02516d106755bdf866047ff7c23900e9ae0 /bitbake/lib/toaster | |
parent | d9341d1a774ccea25e64583f9adc61b163fb1f95 (diff) | |
download | poky-b1c91d06e0262e886154129fb1b6b4a12e3fc5fe.tar.gz |
bitbake: toastergui: use defaults on xhr_datatypeahead parameters
This patch prevents crashes when xhr_datatypeahead is called
without proper parameters.
(Bitbake rev: 4528490cf663790a455815dc48fbf3dda264098c)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index f2626f8521..678e356e0d 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2379,7 +2379,7 @@ if toastermain.settings.MANAGED: | |||
2379 | 2379 | ||
2380 | 2380 | ||
2381 | # returns layers for current project release that are not in the project set, matching the name | 2381 | # returns layers for current project release that are not in the project set, matching the name |
2382 | if request.GET['type'] == "layers": | 2382 | if request.GET.get('type', None) == "layers": |
2383 | # all layers for the current project | 2383 | # all layers for the current project |
2384 | queryset_all = prj.compatible_layerversions().filter(layer__name__icontains=request.GET.get('search','')) | 2384 | queryset_all = prj.compatible_layerversions().filter(layer__name__icontains=request.GET.get('search','')) |
2385 | 2385 | ||
@@ -2394,9 +2394,9 @@ if toastermain.settings.MANAGED: | |||
2394 | 2394 | ||
2395 | 2395 | ||
2396 | # returns layer dependencies for a layer, excluding current project layers | 2396 | # returns layer dependencies for a layer, excluding current project layers |
2397 | if request.GET['type'] == "layerdeps": | 2397 | if request.GET.get('type', None) == "layerdeps": |
2398 | queryset = prj.compatible_layerversions().exclude(pk__in = [x.id for x in prj.projectlayer_equivalent_set()]).filter( | 2398 | queryset = prj.compatible_layerversions().exclude(pk__in = [x.id for x in prj.projectlayer_equivalent_set()]).filter( |
2399 | layer__name__in = [ x.depends_on.layer.name for x in LayerVersionDependency.objects.filter(layer_version_id = request.GET['search'])]) | 2399 | layer__name__in = [ x.depends_on.layer.name for x in LayerVersionDependency.objects.filter(layer_version_id = request.GET.get('search', None))]) |
2400 | 2400 | ||
2401 | final_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset]) | 2401 | final_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset]) |
2402 | 2402 | ||
@@ -2405,11 +2405,11 @@ if toastermain.settings.MANAGED: | |||
2405 | 2405 | ||
2406 | 2406 | ||
2407 | # returns layer versions that would be deleted on the new release__pk | 2407 | # returns layer versions that would be deleted on the new release__pk |
2408 | if request.GET['type'] == "versionlayers": | 2408 | if request.GET.get('type', None) == "versionlayers": |
2409 | 2409 | ||
2410 | retval = [] | 2410 | retval = [] |
2411 | for i in prj.projectlayer_set.all(): | 2411 | for i in prj.projectlayer_set.all(): |
2412 | lv = prj.compatible_layerversions(release = Release.objects.get(pk=request.GET['search'])).filter(layer__name = i.layercommit.layer.name) | 2412 | lv = prj.compatible_layerversions(release = Release.objects.get(pk=request.GET.get('search', None))).filter(layer__name = i.layercommit.layer.name) |
2413 | # there is no layer_version with the new release id, and the same name | 2413 | # there is no layer_version with the new release id, and the same name |
2414 | if lv.count() < 1: | 2414 | if lv.count() < 1: |
2415 | retval.append(i) | 2415 | retval.append(i) |
@@ -2420,12 +2420,12 @@ if toastermain.settings.MANAGED: | |||
2420 | 2420 | ||
2421 | 2421 | ||
2422 | # returns layer versions that provide the named targets | 2422 | # returns layer versions that provide the named targets |
2423 | if request.GET['type'] == "layers4target": | 2423 | if request.GET.get('type', None) == "layers4target": |
2424 | # we return data only if the recipe can't be provided by the current project layer set | 2424 | # we return data only if the recipe can't be provided by the current project layer set |
2425 | if reduce(lambda x, y: x + y, [x.recipe_layer_version.filter(name=request.GET['search']).count() for x in prj.projectlayer_equivalent_set()], 0): | 2425 | if reduce(lambda x, y: x + y, [x.recipe_layer_version.filter(name=request.GET.get('search', None)).count() for x in prj.projectlayer_equivalent_set()], 0): |
2426 | final_list = [] | 2426 | final_list = [] |
2427 | else: | 2427 | else: |
2428 | queryset_all = prj.compatible_layerversions().filter(recipe_layer_version__name = request.GET['search']) | 2428 | queryset_all = prj.compatible_layerversions().filter(recipe_layer_version__name = request.GET.get('search', None)) |
2429 | 2429 | ||
2430 | # exclude layers in the project | 2430 | # exclude layers in the project |
2431 | queryset_all = queryset_all.exclude(pk__in = [x.id for x in prj.projectlayer_equivalent_set()]) | 2431 | queryset_all = queryset_all.exclude(pk__in = [x.id for x in prj.projectlayer_equivalent_set()]) |
@@ -2436,7 +2436,7 @@ if toastermain.settings.MANAGED: | |||
2436 | return HttpResponse(jsonfilter( { "error":"ok", "list" : map( _lv_to_dict, final_list) }), content_type = "application/json") | 2436 | return HttpResponse(jsonfilter( { "error":"ok", "list" : map( _lv_to_dict, final_list) }), content_type = "application/json") |
2437 | 2437 | ||
2438 | # returns targets provided by current project layers | 2438 | # returns targets provided by current project layers |
2439 | if request.GET['type'] == "targets": | 2439 | if request.GET.get('type', None) == "targets": |
2440 | search_token = request.GET.get('search','') | 2440 | search_token = request.GET.get('search','') |
2441 | queryset_all = Recipe.objects.filter(layer_version__layer__name__in = [x.layercommit.layer.name for x in prj.projectlayer_set.all().select_related("layercommit__layer")]).filter(Q(name__icontains=search_token) | Q(layer_version__layer__name__icontains=search_token)) | 2441 | queryset_all = Recipe.objects.filter(layer_version__layer__name__in = [x.layercommit.layer.name for x in prj.projectlayer_set.all().select_related("layercommit__layer")]).filter(Q(name__icontains=search_token) | Q(layer_version__layer__name__icontains=search_token)) |
2442 | 2442 | ||
@@ -2463,7 +2463,7 @@ if toastermain.settings.MANAGED: | |||
2463 | }), content_type = "application/json") | 2463 | }), content_type = "application/json") |
2464 | 2464 | ||
2465 | # returns machines provided by the current project layers | 2465 | # returns machines provided by the current project layers |
2466 | if request.GET['type'] == "machines": | 2466 | if request.GET.get('type', None) == "machines": |
2467 | queryset_all = Machine.objects.all() | 2467 | queryset_all = Machine.objects.all() |
2468 | if 'project_id' in request.session: | 2468 | if 'project_id' in request.session: |
2469 | queryset_all = queryset_all.filter(layer_version__in = prj.projectlayer_equivalent_set()).order_by("name") | 2469 | queryset_all = queryset_all.filter(layer_version__in = prj.projectlayer_equivalent_set()).order_by("name") |