[Email-SIG] fixing the current email module

Timothy Farrell tfarrell at owassobible.org
Sat Oct 3 15:26:10 CEST 2009


Back in June, David Murray posted the message below about fixing the email module.  I have an interest in helping with this due to a personal project I'm working on.  However, my ability to help is severely limited by my understanding of email and MIME RFCs.

David asked the question of whether or not passing strings to the feedparser is a needed behavior.  I don't claim to have enough knowledge to answer the question yes or no, but I would urge us all to consider that if no answer shows up that David's patch should be put in for no better reason than that it's better than what we currently have.

David, if you would send it to me, I might be able to fix up some of the test cases.

Thanks,
-tim


--------
So, designing a new interface is one thing.  Making the current
interface usable in py3k is another.  I presume that the latter
is desirable?

I'm porting a small application that uses the email module to py3k.
I've run into two problems, one of which was already reported, the other
of which was not:

     http://bugs.python.org/issue4661
     http://bugs.python.org/issue6302

(Then there's the whole string issues relating to email and unicode
organized under Issue1685453, but I'm going to ignore those for the
moment.)

I'd like to try fixing these, but there are design issues involved.
The fundamental one is, what format should 'message' be handling message
data in?  4661 addresses this obliquely, and we've talked about this
somewhat at the higher design level.  But the question before me is,
how to fix feedparser, message, and decode_header so that I can actually
parse a message and display it correctly.

I need to be able to feed bytes to feedparser, that much is clear.
I've implemented a proof-of-concept fix that has feedparser handle all
its input as bytes, has message decode headers and values using the
ASCII codec if handled bytes, and has decode_header expect strings and
consistently return bytes.

With this fix in place my application works.  But of course, the
email module tests do not pass, and I don't know what other use
cases I have broken.

My specific question, as posted in issue4661, is: is there any
use case for passing strings to feedparser that is not a design
error waiting to trap the programmer?

--David


More information about the Email-SIG mailing list