From bbc94034b0ab7dbfc4b0f38277a13c25c4e98f18 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Mon, 7 Feb 2011 13:26:25 -0500 Subject: Fallback to default locale (en_US) if env. setting is corrupt. --- ipalib/rpc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ipalib/rpc.py') diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 38be0c6c..051d2c3d 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 = [] -- cgit