Commit 585c9c2e authored by Romain Courteaud's avatar Romain Courteaud

In case of dynamic language selection, prevent browsers to select an

unavailable language on the website.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29645 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5f1c2779
...@@ -122,6 +122,15 @@ class WebSiteTraversalHook(Persistent): ...@@ -122,6 +122,15 @@ class WebSiteTraversalHook(Persistent):
if default_language and container.isStaticLanguageSelection(): if default_language and container.isStaticLanguageSelection():
if request.get('AcceptLanguage') is not None: if request.get('AcceptLanguage') is not None:
request['AcceptLanguage'].set(default_language, 80) request['AcceptLanguage'].set(default_language, 80)
else:
accept_language = request.get('AcceptLanguage')
if accept_language is not None:
selected_language = accept_language.select_language(
container.getAvailableLanguageList())
if selected_language:
request['AcceptLanguage'].set(selected_language, 80)
elif default_language:
request['AcceptLanguage'].set(default_language, 80)
class WebSite(WebSection): class WebSite(WebSection):
""" """
......
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