My, that was nasty.

This commit is contained in:
Ricky Zhou (周家杰) 2008-03-10 00:59:41 -04:00
parent 91b9c9bcfb
commit a07630c17a

View file

@ -29,15 +29,10 @@ turbogears.view.variable_providers.append(add_custom_stdvars)
def get_locale(locale=None):
if locale:
return locale
username = None
try:
username = turbogears.identity.current.user_name
user = turbogears.identity.current.user
return turbogears.identity.user.locale or 'C'
except AttributeError:
pass
if username:
person = People.by_username(turbogears.identity.current.user_name)
return person.locale or 'C'
else:
return turbogears.i18n.utils._get_locale()
config.update({'i18n.get_locale': get_locale})