Commit e419bd73 authored by Yusei Tahara's avatar Yusei Tahara

Set user's preferred language value to request so that next page after login...

Set user's preferred language value to request so that next page after login can use the language value.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23989 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0181597a
...@@ -54,6 +54,9 @@ installation_status = {'bt5': {'current': 0, ...@@ -54,6 +54,9 @@ installation_status = {'bt5': {'current': 0,
'all': 0,}, 'all': 0,},
'activity_list': [],} 'activity_list': [],}
# cookie name to store user's preferred language name
LANGUAGE_COOKIE_NAME = 'configurator_user_preferred_language'
def _isUserAcknowledged(cookiejar): def _isUserAcknowledged(cookiejar):
""" Is user authenticated to remote system through a cookie. """ """ Is user authenticated to remote system through a cookie. """
for cookie in cookiejar: for cookie in cookiejar:
...@@ -428,7 +431,7 @@ class WizardTool(BaseTool): ...@@ -428,7 +431,7 @@ class WizardTool(BaseTool):
configurator_user_preferred_language = 'en' configurator_user_preferred_language = 'en'
if REQUEST is not None: if REQUEST is not None:
# language value will be in cookie or REQUEST itself. # language value will be in cookie or REQUEST itself.
configurator_user_preferred_language = REQUEST.get('configurator_user_preferred_language', configurator_user_preferred_language) configurator_user_preferred_language = REQUEST.get(LANGUAGE_COOKIE_NAME, configurator_user_preferred_language)
parameter_dict['user_preferred_language'] = configurator_user_preferred_language parameter_dict['user_preferred_language'] = configurator_user_preferred_language
def _updateParameterDictWithFileUpload(self, parameter_dict): def _updateParameterDictWithFileUpload(self, parameter_dict):
...@@ -582,7 +585,11 @@ class WizardTool(BaseTool): ...@@ -582,7 +585,11 @@ class WizardTool(BaseTool):
# set user preferred configuration language # set user preferred configuration language
user_preferred_language = REQUEST.get('field_my_user_preferred_language', None) user_preferred_language = REQUEST.get('field_my_user_preferred_language', None)
if user_preferred_language: if user_preferred_language:
REQUEST.RESPONSE.setCookie('configurator_user_preferred_language', # Set language value to request so that next page after login
# can get the value. Because cookie value is available from
# next request.
REQUEST.set(LANGUAGE_COOKIE_NAME, user_preferred_language)
REQUEST.RESPONSE.setCookie(LANGUAGE_COOKIE_NAME,
user_preferred_language, user_preferred_language,
expires=(DateTime()+30).rfc822()) expires=(DateTime()+30).rfc822())
# set encoded __ac_express cookie at client's browser # set encoded __ac_express cookie at client's browser
......
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