[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-22 Thread juan
Hi Massimo, I am also not convinced since I'm new to web2py and python, but It works fine, as expected in every case I have tested with that little correction and a format attribute like this (*nombre* is a *string*, and *precio *is a *decimal(2,2):* format=lambda row: row.nombre + ' - ' + str

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-22 Thread Massimo Di Pierro
I am not sure I am convinced this return (refs and ', '.join(f(r,x.id) for x in refs) or '') always works but for now it is in trunk. On Wednesday, 21 August 2013 19:26:45 UTC-5, juan wrote: > > The issue wasnt completely resolved that way, there were problems with > list:reference in updates a

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-21 Thread juan
The issue wasnt completely resolved that way, there were problems with list:reference in updates and some weird behaviour, always involving lists but no simple references, so I debugged my way down to the web2py code and finally found the problem. In the line 6860 of the file gluon/dal.py, this

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-20 Thread juan
Well, I found a solution for this strangely undocumented issue: format=lambda r: r.nombre.decode("utf-8", 'ignore') + ' - ' + str(r.precio) + '€'.decode("utf-8", 'ignore') Then, using the lambda and decode, it works. Maybe that the 'ignore' isn't neccesary, but I left there just in case. El lu

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-19 Thread juan
Thank you Massimo, but how can it be resolved when the format attribute must represent fields in the database with special chars?. I mean, the hardcoded euro char is the minor problem here. Thanks El jueves, 15 de agosto de 2013 04:07:53 UTC-5, Massimo Di Pierro escribió: > > replace > form

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-15 Thread Massimo Di Pierro
replace format="%(nombre)s - %(precio)s€" with format= "%(nombre)s - %(precio)s\xe2\x82\xac" because labels mush be in ascii (or utf8) but not unicode. On Wednesday, 14 August 2013 15:57:24 UTC-5, juan wrote: > > Hello, > > It seems that the format option in db.define_table isn't working prop