[spambayes-dev] Re: [Spambayes-checkins] spambayes/scripts sb_server.py, 1.15, 1.16

Richie Hindle richie at entrian.com
Wed Dec 31 08:54:25 EST 2003


[Tony]
> Modified Files:
> 	sb_server.py 
> Log Message:
> When we stopped sb_server and then restarted, we didn't init the state, so it
> wouldn't work.  Fix that.
> 
> [...]
> 
>   def prepare():
> +     state.init()
>       state.prepare()

This edit keeps appearing and disappearing.  Mark removed that line in
order to fix the fact that none of sb_server's command line arguments
worked.  Tony has now put it back in order to fix a restart problem, which
has once again broken all the command line arguments.

The docstring for State.__init__() describes how the code was originally
intended to work:

"""Initialises the State object that holds the state of the app.
The default settings are read from Options.py and bayescustomize.ini
and are then overridden by the command-line processing code in the
__main__ code below."""

The __main__ code is now in a function called run(), and the code to read
the options is now in State.init().  Calling State.init() a second time,
as prepare() now does, overwrites the command line options set up by
run().

It does seem weird that there's a State.prepare() and a global prepare(),
but the global prepare() calls both State.init() and State.prepare().  I
don't know much about this code (if it was checked in under my name, it
must have been my evil twin that wrote it 8-)

Does anyone have a clear idea of what each of prepare(), State.__init__(),
State.init(), and State.prepare() are all intended to do?  I think the
command line option code needs to be inserted somewhere into one of them,
but I'm not 100% sure what each of them is for.

PS. (next eight hours):  Mark: You are too drunk to reply.
PS. (after eight hours): Mark: How's the head?  8-)

-- 
Richie Hindle
richie at entrian.com




More information about the spambayes-dev mailing list