[Email-SIG] Feed parser recipe

Barry Warsaw barry at python.org
Tue Sep 28 21:07:23 CEST 2004


I'm just now catching up on email-sig traffic, trying to whip email 3.0
into shape for Python 2.4...

On Thu, 2004-08-26 at 13:14, Anthony Baxter wrote:

> > In particular, the code solves one problem I've seen in real life
> > when using the feed parser. I've seen at least a few spam mails that
> > have a content-type of multipart/<something> but which contain only a
> > single part. The feed parser can parse them, but the resulting
> > Message object is internally inconsistent: get_main_type() returns
> > "multipart" but is_multipart() returns False. In that case, my code
> > applies some messy heuristics in an attempt to figure out what the
> > right content-type is.
> 
> This was something I recall hitting and deciding that the correct
> solution was the current one. I'm not sure what else it could do -
> maybe change the multipart to something else and install a .defects,
> but this really doesn't appeal to me, at all.

Maybe the right thing to do is to leave the message object alone, except
to add a .defect.  I'm thinking something like
MultipartInvariantViolationDefect or somesuch.  It's something you could
easily test by comparing is_multipart() and get_main_type(), but we
might as well do it for you.

Matthew, if you have a sanitized version of the offending message still
laying around, send it to me or post a SF bug with that as the
attachment.  Assign it to me and I'll at least add it to the test suite.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/email-sig/attachments/20040928/a290c2f9/attachment.pgp


More information about the Email-SIG mailing list