Commit ba315d66 authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_web_renderjs_ui: update WebSection_renderDefaultPageAsGadget

so that it does not add two slashes in the computed url
parent 71bf9fc6
...@@ -16,15 +16,18 @@ website_url_set = {} ...@@ -16,15 +16,18 @@ website_url_set = {}
#simplify code of Base_doLanguage, can't ues Base_doLanguage directly #simplify code of Base_doLanguage, can't ues Base_doLanguage directly
root_website_url = web_section.getOriginalDocument().absolute_url() root_website_url = web_section.getOriginalDocument().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 available_language_set)) '|'.join('/' + re.escape(x) for x in available_language_set))
for language in available_language_set: for language in available_language_set:
web_section_url = web_section.absolute_url()
web_section_url = web_section_url[:-1] if web_section_url.endswith('/') else web_section_url
if language == default_language: if language == default_language:
website_url_set[language] = re.sub(website_url_pattern, r'%s/\1' % root_website_url, web_section.absolute_url()) website_url_set[language] = re.sub(website_url_pattern, r'%s/\1' % root_website_url, web_section_url)
else: else:
website_url_set[language]= re.sub(website_url_pattern, r'%s/%s/\1' % (root_website_url, language), web_section.absolute_url()) website_url_set[language]= re.sub(website_url_pattern, r'%s/%s/\1' % (root_website_url, language), web_section_url)
view_as_web_method = default_web_page.getTypeBasedMethod( view_as_web_method = default_web_page.getTypeBasedMethod(
"viewAsWeb", "viewAsWeb",
......
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