summaryrefslogtreecommitdiffstats
path: root/ipalib/rpc.py
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2011-02-07 13:26:25 -0500
committerRob Crittenden <rcritten@redhat.com>2011-03-01 10:31:37 -0500
commitbbc94034b0ab7dbfc4b0f38277a13c25c4e98f18 (patch)
treea851a228d92996e30f0316f2d7b614877a199a3a /ipalib/rpc.py
parentbfca99b420d72388cf0230ff6f5481878e336ca7 (diff)
downloadfreeipa-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.py6
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 = []