[spambayes-dev] Config files and locale

Mark Hammond mhammond at skippinet.com.au
Thu Jul 24 13:59:30 EDT 2003


For those not following the main list, Outlook is having a few "locale"
issues.  You will all have the pleasure of reading more about it soon, as I
intend moving the discussion here - but that issue spawned a side-issue
which I believe will affect all SpamBayes apps.

I note that OptionsClass.py uses functions from the "locale" module to parse
numbers.  Apart from the fact that these functions convert apparently insane
values when not using a period as a decimal point, there is a more
fundamental issue.

If an application ever wants to ship a configuration file that includes a
floating point number, we *must* assume an 'en' locale, (as we will be
shipping 'x.x' in the file).  This means we will force users to also use our
conventions when editing the config file.

This means that the way things stand, it is *not* possible for an app to
ship with a new default of, say, 'spam_cutoff'.  It means that most examples
of config files will be wrong for non 'us' locales, and that config files
can't be shared amongst different users who may have different locales.

Am I correct in seeing this as a problem?

One error prone, slightly insane (but considering locale's existing
behaviour, maybe not) would be to use our own number parser.  Refuse to
allow both a period and a comma in a number.  If either is given, assume it
is the decimal.  Always write the config file in 'us' format.  There are a
few variations on this we could take, depending on what we wanted to
support, but I thought I would get it out there for discussion first.

Any thoughts?

Mark.




More information about the spambayes-dev mailing list