summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-08-18 17:29:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-19 18:05:56 +0100
commit6f176d4c7b4f789c0551fc4caa01beb2eb100364 (patch)
treeb0b9ba8a4be63225785255195b50d5c6d501c6cc /bitbake/lib/toaster/toastergui/views.py
parentab13498eb9462075d0551abbf5cb196ca457df63 (diff)
downloadpoky-6f176d4c7b4f789c0551fc4caa01beb2eb100364.tar.gz
bitbake: toastergui: fix projectbuilds page
This patch fixes the redirection projectbuilds page and the template layout in the projectbuilds page. * The _build_list_helper now returns an empty RedirectException that is properly customized by the caller and re-raised to achieve redirection to the original page (poor man's overloading) * The template for ProjectBuilds is updated as to properly display Build objects instead of BuildRequest objects. [YOCTO #7995] (Bitbake rev: 5982b5df9288a5773c7314234e2e0432f85678f2) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 7ebcfc1150..98d21f4046 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -33,7 +33,7 @@ from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File
33from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact 33from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact
34from bldcontrol import bbcontroller 34from bldcontrol import bbcontroller
35from django.views.decorators.cache import cache_control 35from django.views.decorators.cache import cache_control
36from django.core.urlresolvers import reverse 36from django.core.urlresolvers import reverse, resolve
37from django.core.exceptions import MultipleObjectsReturned 37from django.core.exceptions import MultipleObjectsReturned
38from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger 38from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
39from django.http import HttpResponseBadRequest, HttpResponseNotFound 39from django.http import HttpResponseBadRequest, HttpResponseNotFound
@@ -372,7 +372,6 @@ def _get_queryset(model, queryset, filter_string, search_term, ordering_string,
372# if the value is given explicitly as a GET parameter it will be the first selected, 372# if the value is given explicitly as a GET parameter it will be the first selected,
373# otherwise the cookie value will be used. 373# otherwise the cookie value will be used.
374def _get_parameters_values(request, default_count, default_order): 374def _get_parameters_values(request, default_count, default_order):
375 from django.core.urlresolvers import resolve
376 current_url = resolve(request.path_info).url_name 375 current_url = resolve(request.path_info).url_name
377 pagesize = request.GET.get('count', request.session.get('%s_count' % current_url, default_count)) 376 pagesize = request.GET.get('count', request.session.get('%s_count' % current_url, default_count))
378 orderby = request.GET.get('orderby', request.session.get('%s_orderby' % current_url, default_order)) 377 orderby = request.GET.get('orderby', request.session.get('%s_orderby' % current_url, default_order))
@@ -1894,7 +1893,14 @@ if True:
1894 1893
1895 queryset = Build.objects.exclude(outcome = Build.IN_PROGRESS) 1894 queryset = Build.objects.exclude(outcome = Build.IN_PROGRESS)
1896 1895
1897 context, pagesize, orderby = _build_list_helper(request, queryset) 1896 try:
1897 context, pagesize, orderby = _build_list_helper(request, queryset)
1898 # all builds page as a Project column
1899 context['tablecols'].append({'name': 'Project', 'clcalss': 'project_column', })
1900 except RedirectException as re:
1901 # rewrite the RedirectException
1902 re.view = resolve(request.path_info).url_name
1903 raise re
1898 1904
1899 _set_parameters_values(pagesize, orderby, request) 1905 _set_parameters_values(pagesize, orderby, request)
1900 return context 1906 return context
@@ -1908,7 +1914,7 @@ if True:
1908 mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby } 1914 mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby }
1909 retval = _verify_parameters( request.GET, mandatory_parameters ) 1915 retval = _verify_parameters( request.GET, mandatory_parameters )
1910 if retval: 1916 if retval:
1911 raise RedirectException( 'all-builds', request.GET, mandatory_parameters) 1917 raise RedirectException( None, request.GET, mandatory_parameters)
1912 1918
1913 # boilerplate code that takes a request for an object type and returns a queryset 1919 # boilerplate code that takes a request for an object type and returns a queryset
1914 # for that object type. copypasta for all needed table searches 1920 # for that object type. copypasta for all needed table searches
@@ -2083,8 +2089,6 @@ if True:
2083 {'name': 'Image files', 'clclass': 'output', 2089 {'name': 'Image files', 'clclass': 'output',
2084 'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory", 2090 'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory",
2085 # TODO: compute image fstypes from Target_Image_File 2091 # TODO: compute image fstypes from Target_Image_File
2086 },
2087 {'name': 'Project', 'clcalss': 'project_column',
2088 } 2092 }
2089 ] 2093 ]
2090 } 2094 }
@@ -2655,7 +2659,13 @@ if True:
2655 2659
2656 queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS) 2660 queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS)
2657 2661
2658 context, pagesize, orderby = _build_list_helper(request, queryset) 2662 try:
2663 context, pagesize, orderby = _build_list_helper(request, queryset)
2664 except RedirectException as re:
2665 # rewrite the RedirectException with our current url information
2666 re.view = resolve(request.path_info).url_name
2667 re.okwargs = {"pid" : pid}
2668 raise re
2659 2669
2660 context['project'] = prj 2670 context['project'] = prj
2661 _set_parameters_values(pagesize, orderby, request) 2671 _set_parameters_values(pagesize, orderby, request)