Barry A. Warsaw
barry at zope.com
Fri Aug 16 08:18:20 CEST 2002
[Sorry for any bogus 1/2 dupes -BAW]
Skip forwarded this message to me, but I don't read c.l.py. I'm
trying to respond to the message via gmane, so I don't know if this
will go through. This'll be a fun experiment!
>>>>> "NP" == Neale Pickett <neale at woozle.org> writes:
>> While I doubt the rfc822 module is going away anytime soon, you
>> might want to look at Barry Warsaw's new email package.
NP> Thanks for replying, Skip. I did check out the email
NP> package--it looks nice, but email.Parser is a little more
NP> challenging to port to this method, as it has read loops
NP> within read loops.
Neale, remember that (IMO) the key design choice in the email package
was to split the parser and the generator from the object model. So
while email.Parser.Parser might be difficult to convert, there's
actually not a lot of reason for you to try <wink>. What I would do
instead is write a whole new parsing class that conforms to your input
The really meaty part is _parsebody() of course, and it really wants
to have the whole message body available to do its searching for MIME
separators and such. But what it does isn't magical -- it just makes
calls to the Message class's interface to build up the object model,
so there's no reason why your parser couldn't do the same. If you can
figure out how to do RFC compliant parsing using a push model <wink>.
At least you have a fairly extensive test suite to gauge against.
I'd certainly take a look at anything you come up with, or answer any
questions you might have.
Also, mimelib-dev at lists.sf.net would be a better forum for discussions.
More information about the Python-list