Tornado locale with numbers.

28 views
Skip to first unread message

wsantos

unread,
Sep 4, 2011, 12:03:05 PM9/4/11
to Tornado Web Server
How i can handle currency/decimal numbers with tornado ? i need to
pass a localized number to view ? why can this work like
format_date ?


regards.

Ben Darnell

unread,
Sep 4, 2011, 3:17:40 PM9/4/11
to python-...@googlegroups.com
We don't currently have any support for this, but I'd accept a pull request.

-Ben

wsantos

unread,
Sep 7, 2011, 10:22:28 PM9/7/11
to Tornado Web Server
No problem i do, but i have more question.

Any problem using python locale module ? btw i dont think this is
right i will need to save current locale, change to users one, formate
with locale.currency and rollback the locale like this "http://
djangosnippets.org/snippets/1825/", any advice about this ?

another solution is add numbers/currency info in locale, adding info
on LOCALE_NUMBER.

Waldecir

Ben Darnell

unread,
Sep 8, 2011, 2:36:30 AM9/8/11
to python-...@googlegroups.com
The python locale module is difficult to use in a server since it assumes there is one global locale; I wouldn't recommend using it.  If your needs are simple enough you can write your own number-formatting routines (and possibly submit them for inclusion in tornado.locale); if you want an existing library I would suggest third-party packages like pyicu or babel.

-Ben
Reply all
Reply to author
Forward
0 new messages