[spambayes-dev] Options changes

Meyer, Tony T.A.Meyer at massey.ac.nz
Mon Jun 16 14:29:14 EDT 2003


> 1) Options does a simple "print" for invalid values.
>   It makes sense to me that an exception would be better 
> here.

It used to do this (wait until all the options had been parsed, print an
error for each one, and stop).  I took it out when I redid the options
structure because no matter how much testing I did, I kept missing
little errors.  The hope was to let people continue to function while
pointing out the errors.  The plan always was to return it, though:

In the to-do list:
 o Once the above is done, and we have waited a suitable time, stop
   allowing invalid options in configuration files
 
Things seem to be stable again with the options, so now is probably good
enough a time.

> Can anyone tell me quickly how pop3proxy's config server 
> validates the form input?

In a nutshell:
 * It checks that options.is_valid(section, option, value) is True for
each option. (In UserInterface.py).
 * It checks that there aren't duplicate ports, and that the number of
servers matches the number of ports (ProxyUI.py, and similar in
ImapUI.py).

> 2) Saving to a temp file.  Currently we use TemporaryFile() 
> then shutil.copyfileobj it to the real file.  These may be on 
> different devices. It makes more sense to me to save it to a 
> ".tmp" file in the correct directory, then remove and move 
> the file across.

That's what I originally did, and then I thought that the temp file
routines must be there for a reason, so I figured I should use them :)
No problems with changing it here.

=Tony Meyer



More information about the spambayes-dev mailing list