From 3ac91b56e7611755a02562ef121cb1950b5a5573 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Wed, 22 Oct 2014 00:06:14 +0200 Subject: [PATCH] setlocale: fallback si locale manquante --- gestion/mail/locale_util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gestion/mail/locale_util.py b/gestion/mail/locale_util.py index d69b903c..a69f6bb3 100644 --- a/gestion/mail/locale_util.py +++ b/gestion/mail/locale_util.py @@ -16,6 +16,9 @@ def setlocale(name): saved = locale.setlocale(locale.LC_ALL) try: yield locale.setlocale(locale.LC_ALL, name) + except: + yield saved + print "Warning: Failed setting locale %r" % name finally: locale.setlocale(locale.LC_ALL, saved)