mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot: allow bundle access per name
This commit is contained in:
parent
db2da457ad
commit
a7f6a9b157
@ -184,9 +184,15 @@ class Runbot(Controller):
|
|||||||
|
|
||||||
@route([
|
@route([
|
||||||
'/runbot/bundle/<model("runbot.bundle"):bundle>',
|
'/runbot/bundle/<model("runbot.bundle"):bundle>',
|
||||||
'/runbot/bundle/<model("runbot.bundle"):bundle>/page/<int:page>'
|
'/runbot/bundle/<model("runbot.bundle"):bundle>/page/<int:page>',
|
||||||
|
'/runbot/bundle/<string:bundle>',
|
||||||
], website=True, auth='public', type='http', sitemap=False)
|
], website=True, auth='public', type='http', sitemap=False)
|
||||||
def bundle(self, bundle=None, page=1, limit=50, **kwargs):
|
def bundle(self, bundle=None, page=1, limit=50, **kwargs):
|
||||||
|
if isinstance(bundle, str):
|
||||||
|
bundle = request.env['runbot.bundle'].search([('name', '=', bundle)], limit=1, order='id')
|
||||||
|
if not bundle:
|
||||||
|
raise NotFound
|
||||||
|
return werkzeug.utils.redirect(f'/runbot/bundle/{slug(bundle)}')
|
||||||
domain = [('bundle_id', '=', bundle.id), ('hidden', '=', False)]
|
domain = [('bundle_id', '=', bundle.id), ('hidden', '=', False)]
|
||||||
batch_count = request.env['runbot.batch'].search_count(domain)
|
batch_count = request.env['runbot.batch'].search_count(domain)
|
||||||
pager = request.website.pager(
|
pager = request.website.pager(
|
||||||
@ -202,8 +208,8 @@ class Runbot(Controller):
|
|||||||
'batchs': batchs,
|
'batchs': batchs,
|
||||||
'pager': pager,
|
'pager': pager,
|
||||||
'project': bundle.project_id,
|
'project': bundle.project_id,
|
||||||
'title': 'Bundle %s' % bundle.name
|
'title': 'Bundle %s' % bundle.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
return request.render('runbot.bundle', context)
|
return request.render('runbot.bundle', context)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user