[Spambayes] gratuitous changes? + bugs

Sjoerd Mullender sjoerd at acm.org
Mon Apr 28 10:46:21 EDT 2003

On Mon, Apr 28 2003 "Meyer, Tony" wrote:

> > I did a cvs update today, and I clearly shouldn't have.  My 
> > programs based on spambayes ceased working for a variety of reasons.
> Note that I have endeavoured to post lots of notification about the
> Options [proposed] changes to the list, and the convert script *should*
> be able to convert any old config files.  I've tried to include as much
> backward compatibility code as possible, but there are always going to
> be issues when changing part of the code that's as widely used as
> Options.py.  Getting buggy code is part of the joy of cvs <wink>; along
> with reporting the bug and having it get fixed, of course.

I guess it's my fault for not reading every message in the spambayes
group.  It's just too much!  :-)

> > 1. OptionClass.mergefiles was renamed to OptionClass.merge_files.
> >    Gratuitous change?  Or is there some deeper reason behind 
> >    this.  The change was not mentioned in the cvs log, by the way.
> What do you have that calls mergefiles?  None of the scripts in cvs do
> (well, a search for "mergefiles" doesn't bring anything up).  It was
> renamed because mergefiles is not well named - it should be MergeFiles,
> mergeFiles or merge_files.  It was renamed now because there are lots of
> other changes happening with Options.py, and it makes sense to fix
> everything at once.  I suppose it should have been mentioned in the cvs
> log, sorry, but since I couldn't find anything that called it, I didn't
> rate it as worthy of specific inclusion.

It's one of my own scripts.  None of the available scripts does what I
need, so I wrote my own.  And in order to keep my scripts independent of
any spambayes testing that I was doing at the time, I used mergefiles to
merge in my own settings.

> > 2. Boolean values in my .ini file (or at least the verbose flag) can't
> >    be parsed anymore.  The reason is, the check is_boolen is incorrect
> >    for Python 2.3.  It checks that the allowed_values is a bool, but
> in
> >    actual fact it's a tuple of bools.  See the diff.
> "globals":"verbose" should not be a tuple of bools, it should be a bool
> - it makes no sense for it to be a tuple.  Options.py has the default as
> False - a single bool.  What does your configuration file have?  This
> could definitely be a bug (although it's not that likely that it's just
> for 2.3) - but the bug isn't in the check, it's in reading the value.
> If you can let me know the config line that's causing the problem, I'll
> try and figure a fix ASAP.

The problem occured with a setting 

verbose: False

If you look at the diff you'll see that I changed the test touching
self.allowed_values.  That is *allowed* values.  Which for verbose is
(False, True), i.e. a tuple.  Also look at the except part of the
try-except where the test is for just this tuple.  That's also why it
fails on Python 2.3 but succeeds on 2.2.  2.2 doesn't have the bool type
(types.BooleanType) so you get an AttributeError in the try part.

-- Sjoerd Mullender <sjoerd at acm.org>

More information about the Spambayes mailing list