[Email-SIG] fixing the current email module
Andrew McNamara
andrewm at object-craft.com.au
Mon Oct 19 06:50:26 CEST 2009
> > Your "hit me with your best shot" comment indicates that you want a
> > failure code or exception when the data is bad, and then a way to
> > "retry accepting errors"?
>
>My curent thinking is that the email module should return an object
>representing a partial parse. The way that you find out if it is
>partial is to try to access some data that "should" be in the object.
>If the parse succeeded, the accessor returns the data (which might be
>empty). If the parse did not succeed, you get an AttributeError.
>(This is just a paraphrase of what I wrote in response to Oleg.)
I agree - try to extract as much intelligence as we can from the malformed
message, and hold the unparseable bits in a "bad chunk" object. If
possible, when reserialising the message, e-mail the bad chunk verbatim,
or possibly with minor fixes to keep the containing MIME structure legal
if we have to. But I'd rather see "garbage-in and same garbage-out",
than "garbage-in and even worse garbage out".
Maybe the parsing should lazy where possible: don't recurse deeper
into the structure if all we're doing is looking at a top level header,
for instance.
--
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
More information about the Email-SIG
mailing list