Commit 71bf9fc6 authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_xhtml_style: update Base_doLanguage, so that it does not add two slashes

in the computed url
parent 2e678ec3
...@@ -10,6 +10,7 @@ if website is not None and website.isStaticLanguageSelection(): ...@@ -10,6 +10,7 @@ if website is not None and website.isStaticLanguageSelection():
root_website = website.getOriginalDocument() root_website = website.getOriginalDocument()
default_language = root_website.getDefaultAvailableLanguage() default_language = root_website.getDefaultAvailableLanguage()
root_website_url = root_website.absolute_url() root_website_url = root_website.absolute_url()
root_website_url = root_website_url[:-1] if root_website_url.endswith('/') else root_website_url
website_url_pattern = r'^%s(?:%s)*(/|$)' % ( website_url_pattern = r'^%s(?:%s)*(/|$)' % (
re.escape(root_website_url), re.escape(root_website_url),
'|'.join('/' + re.escape(x) for x in root_website.getAvailableLanguageList())) '|'.join('/' + re.escape(x) for x in root_website.getAvailableLanguageList()))
...@@ -22,9 +23,9 @@ if website is not None and website.isStaticLanguageSelection(): ...@@ -22,9 +23,9 @@ if website is not None and website.isStaticLanguageSelection():
referer_url) referer_url)
else: else:
if select_language == default_language: if select_language == default_language:
redirect_url = root_website_url redirect_url = root_website_url + '/'
else: else:
redirect_url = root_website_url + '/' + select_language redirect_url = root_website_url + '/' + select_language + '/'
return context.REQUEST.RESPONSE.redirect(redirect_url) return context.REQUEST.RESPONSE.redirect(redirect_url)
else: else:
# ERP5 Mode # ERP5 Mode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment