From 9704f06db606fe215e129c832f90decd5632b4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 2 Jul 2008 14:20:10 +0200 Subject: [PATCH] Improve set_locale error message --- trytond/report/report.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/trytond/report/report.py b/trytond/report/report.py index 5f52a3e1d9..cc599f7b88 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -529,15 +529,12 @@ class Report(object): lang = localcontext.get('language', False) or 'en_US' try: if os.name == 'nt': - locale.setlocale(locale.LC_ALL, - _LOCALE2WIN32.get(lang, lang) + '.' + encoding) - else: - locale.setlocale(locale.LC_ALL, lang + '.' + encoding) + lang = _LOCALE2WIN32.get(lang, lang) + locale.setlocale(locale.LC_ALL, lang + '.' + encoding) except Exception: Logger().notify_channel('web-service', LOG_ERROR, 'Report %s: unable to set locale "%s"' % \ - (self._name, - localcontext.get('language', False) or 'en_US')) + (self._name, lang + '.' + encoding) if date: if isinstance(value, time.struct_time): locale_format = LocaleTime().LC_date.replace('%y', '%Y')