On Mar 10, 8:29 am, Malcolm Tredinnick <[email protected]>
wrote:
> On Tue, 2009-03-10 at 02:11 -0700, Joshua Russo wrote:
> > I found this in my searches for formatting a decimal as a proper
> > currency output:http://www.djangosnippets.org/snippets/552/
>
> Oh, that's a really bad idea. :-(
>
> Calling setlocale() in multi-threaded applications is simply not
> something you should do. It changes the locale for *everything*.
> Including things that expect numbers to be formatted in the C locale
> (such as serialisation and deserialisation). In a multi-lingual
> application, it's also going to lead to most threads of execution seeing
> the wrong locale.
>
> Please don't use that snippet. It's broken for anything but the most
> simple, single-threaded use-cases.
>
> If you really want currency formatting and the like at the moment, the
> "babel" project is the place to look. At some point (maybe in 1.1, but I
> wouldn't hold my breath at the moment), Django will have native support
> for some of this stuff, although probably not for things like adding
> commas to long numbers. We do want to add support for the appropriate
> decimal separator in a locale-aware fashion (so you can enter 1,23 in a
> form in  Europe and have it validate correctly). But for all the really
> advanced bells and whistles, use babel.
>
> Regards,
> Malcolm

Great, thanks for the info


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to