[Python-bugs-list] [ python-Bugs-594255 ] email mishandles some multiparts
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 12 Aug 2002 16:42:17 -0700
Bugs item #594255, was opened at 2002-08-12 17:13
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=594255&group_id=5470
Category: Python Library
Group: None
>Status: Closed
>Resolution: Out of Date
Priority: 5
Submitted By: Tim Roberts (timroberts)
Assigned to: Nobody/Anonymous (nobody)
Summary: email mishandles some multiparts
Initial Comment:
Python 2.2 on Windows 2000; also occurs in Python 2.1.
email.Message.Message.is_multipart() returns true if
and only if _payload is a list. _payload becomes a list
only if more than one subpart is added. However, by
RFC 1521, a multipart message is allowed to contain a
single subpart. (I received one today!) In that case,
Message.is_multipart() returns false, and Message.walk
fails to enumerate the subpart. There seems to be no
way to discover that a parsable payload exists.
Suggested and tested fix is to modify the start of
Message.add_payload from this:
if self._payload is None:
self._payload = payload
to this:
if self._payload is None:
if self.get_main_type() == 'multipart':
self._payload = [payload]
else:
self._payload = payload
----------------------------------------------------------------------
>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2002-08-12 19:42
Message:
Logged In: YES
user_id=12800
This is fixed in Python 2.3cvs. It's also fixed in the
standalone mimelib project, in email package version 2.2.
It will be back ported to Python 2.2.2 at some point before
that release is made.
I suggest picking up the mimelib version and using that.
It'll work with Python 2.1 and beyond.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=594255&group_id=5470