A fix for issue 1974, inspired by the patch from Andi Albrecht (aalbrecht),

though with some changes by me.  This patch should not be back ported or
forward ported.  It's a bit too risky for 2.6 and 3.x does things fairly
differently.
This commit is contained in:
Barry Warsaw 2009-03-30 22:42:17 +00:00
parent 55acfc6c87
commit dbf95a3643
4 changed files with 83 additions and 62 deletions

View file

@ -1,5 +1,4 @@
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Copyright (C) 2001-2009 Python Software Foundation
# Contact: email-sig@python.org
"""Classes to generate plain text from a message object tree."""
@ -156,10 +155,13 @@ class Generator:
# be to not split the string and risk it being too long.
print >> self._fp, v
else:
# Header's got lots of smarts, so use it.
# Header's got lots of smarts, so use it. Note that this is
# fundamentally broken though because we lose idempotency when
# the header string is continued with tabs. It will now be
# continued with spaces. This was reversedly broken before we
# fixed bug 1974. Either way, we lose.
print >> self._fp, Header(
v, maxlinelen=self._maxheaderlen,
header_name=h, continuation_ws='\t').encode()
v, maxlinelen=self._maxheaderlen, header_name=h).encode()
# A blank line always separates headers from body
print >> self._fp