[issue13539] A return is missing in TimeEncoding of calendar.py

2011-12-06 Thread psam

New submission from psam :

The v2.6 of __enter__() of TimeEncoding has been fixed in v2.7 in relation with 
the return of setlocale(), but for no apparent reason, its necessary returned 
value is no more there.

Patch:

def __enter__(self):
self.oldlocale = _locale.getlocale(_locale.LC_TIME)
_locale.setlocale(_locale.LC_TIME, self.locale)
+   return _locale.getlocale(_locale.LC_TIME)[1]

--
components: Library (Lib)
messages: 148915
nosy: psam
priority: normal
severity: normal
status: open
title: A return is missing in TimeEncoding of calendar.py
type: behavior
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue13539>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13539] Return value missing in calendar.TimeEncoding.__enter__

2011-12-12 Thread psam

psam  added the comment:

The problem was detected in a Django project, as the template engine was not 
able to support the original encoding.
I don't have a real test code snippet, but you may try something like:

isinstance(calendar.LocaleTextCalendar(locale='').formatmonth(2011,12),unicode)

Note: for Windows, locale='' or locale='fra_FRA' are ok, not locale='fr_FR' or 
no specified locale.

--

___
Python tracker 
<http://bugs.python.org/issue13539>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com