diff --git a/gestion/mail/locale_util.py b/gestion/mail/locale_util.py index a69f6bb3..b5ad20e7 100644 --- a/gestion/mail/locale_util.py +++ b/gestion/mail/locale_util.py @@ -15,10 +15,13 @@ def setlocale(name): with LOCALE_LOCK: saved = locale.setlocale(locale.LC_ALL) try: - yield locale.setlocale(locale.LC_ALL, name) + current_val = locale.setlocale(locale.LC_ALL, name) except: - yield saved + current_val = saved print "Warning: Failed setting locale %r" % name + + try: + yield current_val finally: locale.setlocale(locale.LC_ALL, saved)