Tokio Kikuchi wrote:
>
>This program prints out like this:
>
>multipart/mixed
>None
>text/plain
>text/plain
>Another text with a header
>
>Note that 'A message without header' is not printed out.
>
>If I remove 'If p:' and print the payload unconditionally, I get:
>
>multipart/mixed
>None
>text/plain
>A message without header
>
>text/plain
>Another text with a header
>
>Here, the no-header part is printed out.
The problem is that the 'truth' of an object that has a __len__()
method is "__len__() <> 0", and the __len__() method of an
email.Message object returns the number of headers.
One possible fix is to define a Message.__nonzero__() method in either
email.Message or Mailman.Message.Message as
def __nonzero__(self):
"""Return True if the message has any headers or payload."""
return len(self._headers) + len(self._payload)
since a __nonzero__() method seems to take precedence over a __len__()
method in determining the truth of an object.
Another possible fix in Scrubber.py is to change
for part in msg.walk():
# TK: bug-id 1099138 and multipart
if not part or part.is_multipart():
to:
for part in msg.walk():
# TK: bug-id 1099138 and multipart
if not part.get_payload() or part.is_multipart():
--
Mark Sapiro <[EMAIL PROTECTED]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
------------------------------------------------------
Mailman-Users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org
Security Policy:
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp