Hi Vinicius,

You mean I can use str.format() to format numbers with thousand
separators instead of my function ?, that would be great Could you
give me an example ??

Thanks

On Nov 7, 6:42 pm, Vinicius Assef <vinicius...@gmail.com> wrote:
> Possibly the python version in your production server.
>
> str.format() is available since python 2.6.
>
> --
> Vinicius Assef.
>
> On Mon, Nov 7, 2011 at 7:41 PM,FranklinFreitas
>
>
>
>
>
>
>
> <freitas.frank...@gmail.com> wrote:
> > In order to format numbers with thousands separator and custom number
> > of decimals, I created the following function and included it in my
> > "db.py" model so it could be accessed through the entire application.
>
> > def number_format(num, places=0):
> >    return locale.format("%.*f", (places, num), True)
>
> > I use it my views like:
>
> > {{=number_format(x.vebamt,2)}}
>
> > It works great in my development environment, but after migrating it
> > to production (I am using a linode vps) the function doesn't work, I
> > doesn't give me an error, it just doesn't format the numbers.
>
> > Any ideas what could be wrong ? I searched the group for a solution
> > for formatting numbers and didn't find a previous post on this matter
>
> > Thanks for your help
>
> >Franklin

Reply via email to