A useful, but painful, one-liner to edit money amounts
Peter Otten
__peter__ at web.de
Thu Aug 5 08:27:44 EDT 2010
Chris Withers wrote:
> Peter Otten wrote:
>>>>> locale.setlocale(locale.LC_ALL, ("en_US", "UTF-8"))
>> 'en_US.UTF8'
>>>>> print locale.currency(13535, grouping=True)
>> $13,535.00
>
> Okay, so if I'm writing a wsgi app, and I want to format depending on
> the choices of the currently logged in users, what would you recommend?
>
> I can't do setlocale, since that would affect all users, and in a
> mult-threaded environment that would be bad.
>
> Does that mean the whole locale package is useless to all web-app
Blame it on the C guys ;)
I've seen
http://babel.edgewall.org/wiki/Documentation/intro.html
http://babel.edgewall.org/wiki/ApiDocs/babel.numbers
http://babel.edgewall.org/wiki/BabelFaq#WhatalternativesexistforPythonprojects
mentioned here but not yet tried it myself.
Peter
More information about the Python-list
mailing list