[spambayes-dev] Experimental SpamBayes build available
Mark Hammond
mhammond at skippinet.com.au
Tue Dec 30 23:31:45 EST 2003
> > The ini file for the proxy appeared in "C:\Documents and
> > Settings\rjh\Application Data\SpamBayes\Proxy" as you'd
> > expect, but the database and cache directories appeared in
> > "C:\Program Files\SpamBayes\bin".
>
> Did the ini file have the appropriate [Storage] lines in it?
> It's meant to add them in there, storing the directories in
> that directory, too.
> You didn't already have an ini file in there, did you? (It only
> adds those
> lines if it's a new file, so that it doesn't overwrite
> someone's settings).
I really don't like the code in Options.py that handles the default values
for these storage items. I'm not sure it is to blame, but it did cause me
to see a new .db file created in the cwd, rather than the data directory -
as my INI file already existed, it didn't get the default FQN for the new
option.
IMO, the ini files should generally store relative path names, being
relative to the directory of the config file being used. This means we
never allow the cwd to determine anything other than the location of the
main config file, as all paths resolve via the directory of this file. A
single Options.resolve_path() should be able to do this for us.
Code speaks louder than words - I'm suggesting:
Options.py, line 1156, the code starting:
# If the file doesn't exist, then let's get the user
to
# store their databases and caches here as well, by
# default, and save the file.
db_name = os.path.join(windowsUserDirectory,
"statistics_database.db")
And all similar setting of the options to FQNs die. The default remains
"statistics_database.db" . All code that uses this option
('persistent_storage_file') does so via a new function:
def get_pathname_option(section, value):
filename = options.get(section, value)
if not os.path.isabs(filename):
return filename
# maybe expanduser() to *nix?
return os.path.join(os.path.dirname(optionsPathname), # existing global
filename)
Or-something-like-that ly,
Mark.
More information about the spambayes-dev
mailing list