Author vstinner
Recipients akuchling, giampaolo.rodola, holdenweb, lregebro, pitrou, r.david.murray, rhettinger, sdaoden, vstinner
Date 2011-01-26.00:58:46
SpamBayes Score 1.52511e-06
Marked as misclassified No
Message-id <1296003531.34.0.697675959211.issue9124@psf.upfronthosting.co.za>
In-reply-to
Content
mailbox.patch:
 - open files in binary mode not as text
 - parse as bytes not as Unicode
 - replace email.generator.Generator() by email.generator.BytesGenerator()
 - use .message_from_bytes() instead of .message_from_str()
 - use .message_from_binary_file() instead of .message_from_file()
 - use BytesIO() instead of StringIO()
 - add more methods to _ProxyFile: readable, writable, seekable, flush, closed
 - don't use universal newline (not supported by binary files): I don't remember if the email binary parser supports directly universal newline

I don't know anything about the mailbox module. I just replaced str functions by bytes functions.

Keep Unicode for some things: MH.get_sequence() reads the file using UTF-8 encoding, labels and sequences.

The patch have to be tested on Windows (Windows uses \r\n newline). I only tested on Linux.
History
Date User Action Args
2011-01-26 00:58:52vstinnersetrecipients: + vstinner, akuchling, rhettinger, holdenweb, pitrou, giampaolo.rodola, lregebro, r.david.murray, sdaoden
2011-01-26 00:58:51vstinnersetmessageid: <1296003531.34.0.697675959211.issue9124@psf.upfronthosting.co.za>
2011-01-26 00:58:47vstinnerlinkissue9124 messages
2011-01-26 00:58:47vstinnercreate