[Spambayes] defaults vs. chi-square
Guido van Rossum
guido@python.org
Tue, 15 Oct 2002 00:17:52 -0400
> TP> So, Barry, what can we do about this? Filling the database
> TP> with "skip" tokens from raw base64 is a Bad Idea, and I assume
> TP> the email pkg doesn't know how to, e.g., "decode base64 up
> TP> until it can't anymore, and then grab the rest as plain text".
> TP> Heh -- just writing that made me want to puke. We have to do
> TP> something better with this, though.
>
> Upgrade to MM2.1 :)
>
> Seriously, when the email package has to decode a base64 payload, it
> just hands the whole string off to base64.decodestring(). Given that
> that function isn't very forgiving, I'm not sure what to do. Sucks.
Split it up in lines first, and collect lines that match a simple
regexp to recognize base64. Then feed the collected stuff to
base64.decodestring(). If there's non-white excess, deal with that
separately.
--Guido van Rossum (home page: http://www.python.org/~guido/)