On 3/25/2011 1:10 PM, Barry Warsaw wrote:
For message parsing, it seems like allowing registered callbacks for various
>pieces would be handy... "Call me when you parse this type of a header" (or
>body part, etc.).
I think David's design documents to allow for extensions and callbacks based
on the content-types of things seen.

I recall registration of handlers for various mime times. I don't recall callbacks (registered handlers) being available for header parsing, but no time to find and reread at the moment. Would be a good idea, though. Also, callbacks should have the capability to stop the parse. That technique could be used to implement "only parse headers" also, but it might be nicer to implement that as a flag when parsing starts.

Along this line, if parsing is stopped, it would be nice to be able to retrieve the unparsed data for alternate use (some is likely to have been already retrieved from whatever data stream, and passed as a "chunk" to the parser; an early-out would leave a "partial chunk" that hasn't been processed, but may want to be processed by some other entity, even if only for logging or error reporting.

--
Glenn
------------------------------------------------------------------------
Experience is that marvelous thing that enables you to recognize a
mistake when you make it again. -- Franklin Jones
_______________________________________________
Email-SIG mailing list
Email-SIG@python.org
Your options: 
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to