Author kitterma
Recipients kitterma
Date 2011-03-14.07:32:57
SpamBayes Score 6.62542e-05
Marked as misclassified No
Message-id <1300087978.39.0.703069545984.issue11492@psf.upfronthosting.co.za>
In-reply-to
Content
Header folding is very different (non-existent as far as I've found so far) in Python3.  Here's a short example:

#!/usr/bin/python
# -*- coding: ISO-8859-1

from email.header import Header

hdrin = 'Received: from mailout00.controlledmail.com (mailout00.controlledmail.com [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for <bcc@kitterman.com>; Sun, 13 Mar 2011 23:46:05 -0400 (EDT)'

print(Header(hdrin))

With python2.6 the output is:


Received: from mailout00.controlledmail.com (mailout00.controlledmail.com
 [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for
 <bcc@kitterman.com>; Sun, 13 Mar 2011 23:46:05 -0400 (EDT)

With python3.1 or 3.2 the output is one line:

Received: from mailout00.controlledmail.com (mailout00.controlledmail.com [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for <bcc@kitterman.com>; Sun, 13 Mar 2011 23:46:05 -0400 (EDT)

This makes it very difficult to write header processing code that works for both Python2 and Python3 even if one can fold headers at all in Python3.
History
Date User Action Args
2011-03-14 07:32:58kittermasetrecipients: + kitterma
2011-03-14 07:32:58kittermasetmessageid: <1300087978.39.0.703069545984.issue11492@psf.upfronthosting.co.za>
2011-03-14 07:32:57kittermalinkissue11492 messages
2011-03-14 07:32:57kittermacreate