[Mailman-Users] A scrubber issue

Todd Zullinger tmz at pobox.com
Sat Dec 9 17:53:49 CET 2006


Tokio Kikuchi wrote:
> It looks like the problem is something to do with email package
> behavior.  Here is a test code to reproduce the problem:

That's neat.  I like how you can do

if not p:
    print p

and it'll print out "A message without header".  :)

Would an (ugly, amateurish) work-around like the following be a start?
I don't know what sort of test message would trigger bug 1099138 so I
didn't test for that case to see that this wouldn't be a regression.
Also, this only gets the first message part from Werner's message to
show up in the archives, the second part is still scrubbed, but at
least there is a link to download it.

--- 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()

Thanks Mark and Tokio for digging into this.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
======================================================================
Ever notice that even the busiest people are never too busy to tell
you just how busy they are?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
Url : http://mail.python.org/pipermail/mailman-users/attachments/20061209/7fa1536f/attachment.pgp 


More information about the Mailman-Users mailing list