No. I said probably you're using format() in a version it is not supported yet. But I'm not sure about it.
I never lay on server locale dependancy. I live in Brazil, and here we have numbers formatted this way: "1.000,00". (dot separates thousands. Comma separates decimal). So, I did this simple funcion: def g_brazilian_decimal(s): return s.replace('.', '*').replace(',', '.').replace('*', ',') And when I need to show some decimal data, I call: {{=g_brazilian_decimal('%.2f' % row.my_decimal_field)}} I don't know if your need is alike mine, but this is how I manage it. -- Vinicius Assef. On Tue, Nov 8, 2011 at 11:10 AM, Franklin Freitas <freitas.frank...@gmail.com> wrote: > 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