It seems that something isn't working properly when using the attribute
'format' and not-only English chars on db.define_table when deployed on GAE
Please, consider theses two table definitions:
db.define_table('ingrediente',
Field('nombre', 'string',
requires=IS_NOT_EMPTY(error_message='Se ha de indicar el nombre')),
Field('precio', 'decimal(2,2)',
requires=IS_NOT_EMPTY(error_message='Se ha de indicar el precio'),
default=1),
format="%(nombre)s - %(precio)s")
db.define_table('bocadillo',
Field('nombre', 'string',
requires=IS_NOT_EMPTY(error_message='Se ha de indicar el nombre')),
Field('precio', 'decimal(2,2)',
requires=IS_NOT_EMPTY(error_message='Se ha de indicar el precio'),
default=4.5),
Field('ingredientes', 'list:reference ingrediente',
comment='Seleccionar los componentes del bocadillo prediseñado usando
Control+click.'),
format='%(db.fotos)s - %(nombre)s - %(precio)s')
As you see, the second table has a one to many relation wich I would want
to be represented by the format attribute stated in the definition of the
first. The problem appears when I have non-English chars set in the first
table, chars as (áóé...) at the time to render a SQLFORM on the second
table.
Still, if I set the preferred format to the first table:
format="%(nombre)s - %(precio)s€" (Note the €)
Then it fails every time.
It happens only in deployed GAE, not in local whether GAE or not.
I attach here the logs from GAE wich points out to an encodind issue:
Traceback (most recent call last):
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/gluon/restricted.py",
line 212, in restricted
exec ccode in environment
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/applications/lapanza/controllers/appadmin.py",
line 433, in <module>
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/gluon/globals.py",
line 194, in <lambda>
self._caller = lambda f: f()
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/applications/lapanza/controllers/appadmin.py",
line 127, in insert
form = SQLFORM(db[table], ignore_rw=ignore_rw)
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/gluon/sqlhtml.py",
line 1140, in __init__
inp = self.widgets.options.widget(field, default)
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/gluon/sqlhtml.py",
line 278, in widget
options = requires[0].options()
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/gluon/validators.py",
line 553, in options
self.build_set()
File
"/base/data/home/apps/s~lapanzaadomicilio-hrd/1.369502662945631224/gluon/validators.py",
line 548, in build_set
self.labels = [self.label % r for r in records]UnicodeDecodeError:
'ascii' codec can't decode byte 0xe2 in position 10: ordinal not in
range(128)
Is there anything I missed or a workaround to solve this?.
This is my first question here and I'm totally new to this great framework,
please, if this is already stated somewhere please refer it to me.
Thank you.
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.