From cebce64b008465fce42eb0defa6c4a6763c51ce3 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 11 May 2014 17:32:35 +0200 Subject: [PATCH] [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 --- addons/website/controllers/main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 7880603d720..95835884c3e 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):