[FIX] mail: format_tz crash if server locale returns non-ascii month name

When there is no lang set, format_tz uses server locale to format a
date. If my server is in French, date is formatted using '%B' (full
localized month name). This can lead non-ascii strings like
"décembre"...
This commit is contained in:
Richard Mathot
2015-12-23 10:44:51 +01:00
committed by Thibault Delavallée
parent aef8a4d618
commit 6191e3f6d0
+1 -1
View File
@@ -59,7 +59,7 @@ def format_tz(pool, cr, uid, dt, tz=False, format=False, context=None):
format_date = lang_params.get("date_format", '%B-%d-%Y')
format_time = lang_params.get("time_format", '%I-%M %p')
fdate = ts.strftime(format_date)
fdate = ts.strftime(format_date).decode('utf-8')
ftime = ts.strftime(format_time)
return "%s %s%s" % (fdate, ftime, (' (%s)' % tz) if tz else '')