[FIX] runbot: don't crash when there is no accessible project

This commit is contained in:
Xavier-Do 2022-10-18 11:53:58 +02:00 committed by Christophe Monniez
parent 16e71d064a
commit 50a7120949
2 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,7 @@ def route(routes, **kw):
if keep_search and cookie_search != search:
response.set_cookie('search', search)
project = response.qcontext.get('project') or projects[0]
project = response.qcontext.get('project') or projects and projects[0]
response.qcontext['projects'] = projects
response.qcontext['more'] = more
@ -54,7 +54,8 @@ def route(routes, **kw):
response.qcontext['refresh'] = refresh
response.qcontext['filter_mode'] = filter_mode
response.qcontext['default_category'] = request.env['ir.model.data']._xmlid_to_res_id('runbot.default_category')
response.qcontext['qu'] = QueryURL('/runbot/%s' % (slug(project)), path_args=['search'], search=search, refresh=refresh)
response.qcontext['qu'] = QueryURL('/runbot/%s' % (slug(project) if project else ''), path_args=['search'], search=search, refresh=refresh)
if 'title' not in response.qcontext:
response.qcontext['title'] = 'Runbot %s' % project.name or ''
response.qcontext['nb_build_errors'] = nb_build_errors

View File

@ -25,7 +25,7 @@
<t t-esc="message" />
</div>
<div t-if="not project" class="mb32">
<h1>No project</h1>
<h3>No project</h3>
</div>
<div t-else="">
<div t-foreach="bundles" t-as="bundle" class="row bundle_row">