[Python-checkins] CVS: python/dist/src/Lib/email Generator.py,1.6,1.6.10.1
Barry Warsaw
bwarsaw@users.sourceforge.net
Fri, 22 Mar 2002 08:21:58 -0800
Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv1301
Modified Files:
Tag: release22-maint
Generator.py
Log Message:
_handle_multipart(): Fixes for SF bug #531966. Specifically two
situations are handled now: a multipart/* containing no payload
(i.e. never set), and a multipart/* containing a scalar payload
(i.e. Message.add_payload() having been called exactly once, not
passing in a sequence object).
_make_boundary(): Fixed bogus cut-n-paste error (self as first arg).
I will merge these changes into the standalone email package and
Python 2.3 separately.
Index: Generator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v
retrieving revision 1.6
retrieving revision 1.6.10.1
diff -C2 -d -r1.6 -r1.6.10.1
*** Generator.py 19 Oct 2001 04:06:39 -0000 1.6
--- Generator.py 22 Mar 2002 16:21:56 -0000 1.6.10.1
***************
*** 238,242 ****
# present in the payload.
msgtexts = []
! for part in msg.get_payload():
s = StringIO()
g = self.__class__(s, self._mangle_from_, self.__maxheaderlen)
--- 238,255 ----
# present in the payload.
msgtexts = []
! # BAW: kludge for broken add_payload() semantics; watch out for
! # multipart/* MIME types with None or scalar payloads.
! subparts = msg.get_payload()
! if subparts is None:
! # Nothing has every been attached
! boundary = msg.get_boundary(failobj=_make_boundary())
! print >> self._fp, '--' + boundary
! print >> self._fp, '\n'
! print >> self._fp, '--' + boundary + '--'
! return
! elif not isinstance(subparts, ListType):
! # Scalar payload
! subparts = [subparts]
! for part in subparts:
s = StringIO()
g = self.__class__(s, self._mangle_from_, self.__maxheaderlen)
***************
*** 370,374 ****
# Helper
! def _make_boundary(self, text=None):
# Craft a random boundary. If text is given, ensure that the chosen
# boundary doesn't appear in the text.
--- 383,387 ----
# Helper
! def _make_boundary(text=None):
# Craft a random boundary. If text is given, ensure that the chosen
# boundary doesn't appear in the text.