[Spambayes] Storing Options [was Outlook feature request]

Mark Hammond mhammond at skippinet.com.au
Thu Feb 27 09:36:37 EST 2003

I'm a little confused :)

First, a little history: when I picked up spambayes, it indirectly used the
Python ConfigParser module for options.  This module handles "ini files on
steriods", and is quite nice - except that the module does not support
*writing* to the file.

For the Outlook plugin, I needed to persist a number of new options that
were being configured in the GUI - such as the list of folders to watch and
filter to.  However, I could see no reasonable way to *write* a config file,
while still maintaining the INI-like file as the user intends - ie, with
comments, etc.

So I simply punted, and kept the INI-like file for user-maintained options,
and a pickle for the GUI maintained ones.

Tony then started discussing further options, and I pointed out that I hated
the 2-file scheme I hacked together.  I didn't want the code to know *where*
an option was stored, as that would make future changes to the GUI very
painful (as the location of where the option is stored would need to change
depending on it is was a "hidden" option or not)

> [TimS]
> > I see no use for a pickle here.  Why keep an ini file and a
> > pickle in sync?
> > Just use the ini file as the persistence.  ConfigParser does

*writing* the INI file is an issue, especially if you want to keep user
comments, and I believe you do.

> [New update ini function]
> > This sounds good to me.  I wonder if the Options file is
> > really what we need to carry forward, though.
> > A simple ini file is really more useful and
> > maintainable (imo), and the options module could easily be
> > modified to support the same syntax that it supports now,
> > but read from an ini file.  The syntax
> > is the only value that it adds now anyway, and that's what should be
> > preserved.

I'm a little confused by this.  As far as I can tell, we already *do* have
an INI file, but for reasons of OS politics <wink>, it is called an
"options" file.

But from my POV, if we can write entries to an options file, I would need
nothing else.  I note that Tony has done some work in this regard, but I
just haven't got to it yet.


More information about the Spambayes mailing list