Fix get_locale() to make logout() work without traceback.
This commit is contained in:
parent
6879e07e72
commit
3326b99938
1 changed files with 7 additions and 2 deletions
|
@ -28,9 +28,14 @@ turbogears.view.variable_providers.append(add_custom_stdvars)
|
||||||
def get_locale(locale=None):
|
def get_locale(locale=None):
|
||||||
if locale:
|
if locale:
|
||||||
return locale
|
return locale
|
||||||
if turbogears.identity.current.user_name:
|
username = None
|
||||||
|
try:
|
||||||
|
username = turbogears.identity.current.user_name
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
if username:
|
||||||
person = People.by_username(turbogears.identity.current.user_name)
|
person = People.by_username(turbogears.identity.current.user_name)
|
||||||
return person.locale
|
return person.locale or 'C'
|
||||||
else:
|
else:
|
||||||
return turbogears.i18n.utils._get_locale()
|
return turbogears.i18n.utils._get_locale()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue