diff options
author | Pavel Zuna <pzuna@redhat.com> | 2011-02-07 13:26:25 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-03-01 10:31:37 -0500 |
commit | bbc94034b0ab7dbfc4b0f38277a13c25c4e98f18 (patch) | |
tree | a851a228d92996e30f0316f2d7b614877a199a3a /ipalib/rpc.py | |
parent | bfca99b420d72388cf0230ff6f5481878e336ca7 (diff) | |
download | freeipa-bbc94034b0ab7dbfc4b0f38277a13c25c4e98f18.tar.gz freeipa-bbc94034b0ab7dbfc4b0f38277a13c25c4e98f18.tar.xz freeipa-bbc94034b0ab7dbfc4b0f38277a13c25c4e98f18.zip |
Fallback to default locale (en_US) if env. setting is corrupt.
Diffstat (limited to 'ipalib/rpc.py')
-rw-r--r-- | ipalib/rpc.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 38be0c6c6..051d2c3de 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -196,7 +196,11 @@ class LanguageAwareTransport(Transport): def get_host_info(self, host): (host, extra_headers, x509) = Transport.get_host_info(self, host) - lang = locale.setlocale(locale.LC_ALL, '').split('.')[0].lower() + try: + lang = locale.setlocale(locale.LC_ALL, '').split('.')[0].lower() + except locale.Error: + # fallback to default locale + lang = 'en_us' if not isinstance(extra_headers, list): extra_headers = [] |