[issue11024] imaplib: Time2Internaldate() returns localized strings

2011-01-28 Thread Sebastian Spaeth

Sebastian Spaeth sebast...@sspaeth.de added the comment:

 Added file: imaplib_Time2Internaldate_locale_fix.patch

The patch looks very good to me and works. I agree that we should be
returning a bytearray but this is should not be part of this issue.

For all that it's worth:
Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11024
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11024] imaplib: Time2Internaldate() returns localized strings

2011-01-27 Thread Sebastian Spaeth

New submission from Sebastian Spaeth sebast...@sspaeth.de:

imaplib's Time2Internaldate returns invalid (as localized) INTERNALDATE 
strings. Appending a message with such a time string leads to a:
19 BAD Command Argument Error. 11 (for MS Exchange IMAP servers)

it returned 26-led-2011 18:23:44 +0100, however:

http://tools.ietf.org/html/rfc2060.html defines:
date_month  ::= Jan / Feb / Mar / Apr / May / Jun /
Jul / Aug / Sep / Oct / Nov / Dec

so it expects an English date format.

imaplib's Time2Internaldate uses time.strftime() to create the final string 
which uses the current locale, returning things such as:

26-led-2011 18:23:44 +0100 rather than 26-Jan-2011 18:23:44 +0100.

For the right thing to do, we would need to set 
locale.setlocale(locale.LC_TIME, '') to get English formatting or we would need 
to use some home-grown parser that hardcodes the proper terms.

--
components: Library (Lib)
messages: 127186
nosy: spaetz
priority: normal
severity: normal
status: open
title: imaplib: Time2Internaldate() returns localized strings
type: behavior
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11024
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11024] imaplib: Time2Internaldate() returns localized strings

2011-01-27 Thread Sebastian Spaeth

Sebastian Spaeth sebast...@sspaeth.de added the comment:

P.S. To replicate this in ipython:

import locale, imaplib

locale.setlocale(locale.LC_ALL,'de_CH.utf8')
imaplib.Time2Internaldate(220254431)
Out[1]: '24-Dez-1976 06:47:11 +0100'

(Note the German 'Dez' rather than 'Dec')

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11024
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11024] imaplib: Time2Internaldate() returns localized strings

2011-01-27 Thread Sebastian Spaeth

Sebastian Spaeth sebast...@sspaeth.de added the comment:

CC'ing lavajoe as he seemed to be busy with some of imaplib's Date stuff the 
last couple of days.

--
nosy: +lavajoe

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11024
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11024] imaplib: Time2Internaldate() returns localized strings

2011-01-27 Thread Sebastian Spaeth

Sebastian Spaeth sebast...@sspaeth.de added the comment:

I think I found the issue he mentioned, however it was about the functions 
taking the local time (rather than UTC), which is fine.

The problem is that Time2Internaldate is used for every .append() operation 
internally, producing invalid dates which are handed to the IMAP server. So in 
most cases, the IMAP server will silently ignore the time and use the current 
time (as per IMAP RFC) or it will complain and barf out (as the MS Exchange 
server rightly does.

So this is more than just an inconvenience, it outright prevents intenational 
users from APPENDing new messages to a server (or silently bodges the message 
date) as there is no way around using that function...

Sorry if this sounds like whining :-) I don't even have a patch handy...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11024
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com