This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 kitterma
收信人 kitterma
日期 2011-03-14.07:32:57
SpamBayes Score 6.6254215e-05
Marked as misclassified
Message-id <1300087978.39.0.703069545984.issue11492@psf.upfronthosting.co.za>
In-reply-to
内容
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.
历史
日期 用户 动作 参数
2011-03-14 07:32:58kitterma修改recipients: + kitterma
2011-03-14 07:32:58kitterma修改messageid: <1300087978.39.0.703069545984.issue11492@psf.upfronthosting.co.za>
2011-03-14 07:32:57kitterma链接issue11492 messages
2011-03-14 07:32:57kitterma创建