[spambayes-dev] If msg.as_string() fails...
tameyer at ihug.co.nz
Mon May 3 01:30:32 EDT 2004
> I looked through the code that generates messages in
> sb_filter.py. In theory, down in mboxutils.get_message() we
> could attach the raw message text to the generated Message
> object if the input was a string:
> msg._raw = obj
Something like this would also work (in theory) for sb_server/sb_imapfilter
put in message.py.
> That doesn't help if the object being parsed is already a
> Message object. It also seems like a very bad hack just to
> make the raw text available in case message flattening fails
> at tail end.
Agreed. I'm not we can come up with a really nice general solution (other
than Anthony's new, relaxed, parser, which I presume will end up in an email
package one of these days). For this particular problem (reports of which
are increasing) what about something like this?
... print msg.as_string()
... except TypeError:
... parts = 
... for part in msg.get_payload():
... print "\n".join(parts)
Obviously the "print"s would be return's or whatever.
More information about the spambayes-dev