[Spambayes] RE: Further Improvement 2

Guido van Rossum guido@python.org
Sun, 22 Sep 2002 22:48:46 -0400


> So, what does it take to use the new email package with the older
> 2.2.1.  Is there a HUGE dependancy involved?

I think the new email package should work without change (or with very
little change) with 2.2.1.  In fact I believe the intention is to
backport the new email package to 2.2.2.  But I don't want to import
the entire email package into the spambayes CVS tree.

> >get_content_type() and friends is another useful change.  According to
> >the RFCs, all messages/parts have a content type, which may be an
> >implicit default.  Python 2.2's email package didn't support this by
> >2.3's does.

I've checked the uses of get_type() (all in tokenizer.py), and I
believe that they all do the right thing except possibly one.  This
code:

            # Remove HTML/XML tags.
            if (part.get_type() == "text/plain" or
                    not options.retain_pure_html_tags):
                text = html_re.sub(' ', text)

should become:

            # Remove HTML/XML tags.
            if (part.get_type('text/plain') == "text/plain" or
                    not options.retain_pure_html_tags):
                text = html_re.sub(' ', text)

--Guido van Rossum (home page: http://www.python.org/~guido/)