From: Fabien Pinckaers Date: Sun, 11 May 2014 15:32:35 +0000 (+0200) Subject: [FIX] better handling of '/'. / is the first menu and not the first menu is /. Allows... X-Git-Tag: InsPy_master01~42 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=cebce64b008465fce42eb0defa6c4a6763c51ce3;p=odoo%2Fodoo.git [FIX] better handling of '/'. / is the first menu and not the first menu is /. Allows to move the first menu in another position bzr revid: fp@tinyerp.com-20140511153235-6mmygt69z45rcx4r --- diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 7880603..9583588 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -34,15 +34,18 @@ class Website(openerp.addons.web.controllers.main.Home): #------------------------------------------------------ @http.route('/', type='http', auth="public", website=True, multilang=True) def index(self, **kw): + page = 'homepage' try: main_menu = request.registry['ir.model.data'].get_object(request.cr, request.uid, 'website', 'main_menu') first_menu = main_menu.child_id and main_menu.child_id[0] - # Dont 302 loop on / - if first_menu and not ((first_menu.url == '/') or first_menu.url.startswith('/#') or first_menu.url.startswith('/?')): - return request.redirect(first_menu.url) + if first_menu: + if not (first_menu.startswith(('/page/', '/?', '/#')) or (first_menu=='/')): + return request.redirect(first_menu.url) + if first_menu.startswith('/page/'): + page = first_menu[6:] except: pass - return self.page("website.homepage") + return self.page(page) @http.route(website=True, auth="public", multilang=True) def web_login(self, *args, **kw):