Todd Zullinger wrote:
>
>--- Scrubber.py~ 2006-10-01 16:28:57.000000000 -0400
>+++ Scrubber.py 2006-12-09 11:41:25.000000000 -0500
>@@ -334,7 +334,12 @@
> text = []
> for part in msg.walk():
> # TK: bug-id 1099138 and multipart
>- if not part or part.is_multipart():
>+ if not part:
>+ try:
>+ part.as_string()
>+ except:
>+ continue
>+ elif part.is_multipart():
> continue
> # All parts should be scrubbed to text/plain by now.
> partctype = part.get_content_type()
In another reply, I suggested a simpler change
--- Scrubber.py~ 2006-10-01 16:28:57.000000000 -0400
+++ Scrubber.py 2006-12-09 11:41:25.000000000 -0500
@@ -334,7 +334,7 @@
text = []
for part in msg.walk():
# TK: bug-id 1099138 and multipart
- if not part or part.is_multipart():
+ if not part.get_payload() or part.is_multipart():
continue
# All parts should be scrubbed to text/plain by now.
partctype = part.get_content_type()
but I'm not sure. This will discard a part with an 'empty' payload as
well as a part with payload = None. The argument for doing this is no
real harm is done by discarding this 'empty' payload, and we probably
don't want to replace it with a link in any case which might happen if
we leave it.
In order to fix the bug we really only need to skip parts with payload
= None so if we want to keep the 'empty' part, the fix should be
--- Scrubber.py~ 2006-10-01 16:28:57.000000000 -0400
+++ Scrubber.py 2006-12-09 11:41:25.000000000 -0500
@@ -334,7 +334,7 @@
text = []
for part in msg.walk():
# TK: bug-id 1099138 and multipart
- if not part or part.is_multipart():
+ if part.get_payload() == None or part.is_multipart():
continue
# All parts should be scrubbed to text/plain by now.
partctype = part.get_content_type()
--
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