[spambayes-dev] Using reload() with modules from zips (Was MoreCVSbranch/tags questions)

Mark Hammond mhammond at skippinet.com.au
Mon Dec 8 07:03:16 EST 2003


[Tony, quoting me]
> > I'm also not sure exactly *why* we are doing a reload -
> > saving user options should not require us to reload the
> > Options module, and I'm fairly sure no code exists that
> > updates the .zip with a new Options file even if it did :)
>
> I *think* (before my time, IIRC) the reason is to generate a new
> Options.options object, that has all the new values.  I had
> figured that the
> correct behaviour for us would be to remove the reload and explicitly
> recreate/update the options object.

Yes - the 'Options' module's mainline code actually reads the config file -
so I can see why a reload is needed if you want to re-read an options file
that may have been externally modified (now that I think about it <wink>)

The solution seems pretty simple: the top-level Options code gets moved into
a function, an 'if __name__' block is added which calls it, and all
occurrences of reload(Options) are also replaced similarly.

I'll do it, unless someone beats me to it (fingers crossed - I've lost the
context, such as any existing bugs etc), or I forget <0.1-wink>

Mark.




More information about the spambayes-dev mailing list