some sort of threadsafe locale support

François Lepoutrre francois.lepoutre at seriatim.com
Fri Nov 15 04:01:32 EST 2002


We have a modpython delivering fully dynamic content
over the wire that uses "locale.format" to deliver fully
formatted numerics.

The application is now supposed to go "intl" and
deliver numeric amounts formatted according to
the user locale. That looked pretty simple...

We change locale ("locale.setlocale()") on the fly
and got comic results as french people would,
at times, receive  us-formatted amounts
and vice-versa...

As clearly stated in python documentation,
locale services are not threadsafe and
possibly costly. Definitely not a good idea.

Any threadsafe alternative to format numeric output
is welcome :) Of course we could do it the
dummy way writing our own formatting stuff.

Any clever alternative to "wheel-reinventing"
for this simple but irritating issue?

Francois






More information about the Python-list mailing list