you have corrputed data in the db. You stored something in a field that was a "string" and now is a "date". web2py cannot get the record out because it is not what it should be.
On May 4, 7:11 pm, Leandro - ProfessionalIT <lsever...@gmail.com> wrote: > Hi Friends, > > I'm developing a 'calendar' (agenda in portuguese) app and this app > is deployed in GAE. > > My db.py > # the data_hora field have a brazilian format and I cannot have two > records in the same data/time (only a event in a date/time) > db.define_table('agenda', > Field('data_hora','datetime', default=now, requires=[IS_DATE('%d/ > %m/%Y %H:%M'), IS_NOT_IN_DB(db, 'agenda.data_hora')], unique=True, > label=T('Data/Hora')), > Field('cliente_id', db.cliente, requires=IS_NULL_OR(IS_IN_DB(db, > 'cliente.id', 'cliente.alcunha')), label=T('Cliente')), > Field('nome','string', length=255, default='', label=T('Cliente > Novo')), > Field('telefone_cliente','string', requires=IS_NOT_EMPTY(), > length=50, default='', label=T('Telefone Cliente')), > Field('servico_id', db.servico, requires=IS_NULL_OR(IS_IN_DB(db, > 'servico.id', 'servico.nome')), label=T('Serviço')), > Field('atendente_id', db.atendente, > requires=IS_NULL_OR(IS_IN_DB(db, 'atendente.id', > 'atendente.alcunha')), label=T('Atendente')), > Field('origem_cliente','string', length=20, default='Telefone', > requires=IS_IN_SET(['Site', 'Telefone', 'Visita a Estética', 'e-mail', > 'MSN','Mailisting']), label=T('Origem Cliente')), > Field('status','string', length=8, default='Agendado', > requires=IS_IN_SET(['Agendado', 'Atendendo', 'Atendido', > 'Cancelado']), label=T('Status'))) > > My Controller: > > def agendas(): > return dict(rows = crud.select(db.agenda, _id='list'), create_link > = A('Novo Registro', _href=URL(r=request, f = 'agenda_create'), > _id="create_link")) > > def agenda(): > return dict(form=crud.update(db.agenda, request.args[0], > next=URL(r = request,f = 'agendas'))) > > def agenda_create(): > return dict(form=crud.create(db.agenda, next=URL(r = request,f = > 'agendas'), message=T("Registro Inserido com Sucesso !"))) > > Well, > The CRUD form to create a record is displayed with success, but > when I click in submit button I receive this error message: > > # > > 1. > 05-04 05:01PM 10.403 /init/rotinas/agenda_create 500 267ms > 349cpu_ms 155api_cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686; en-US; rv: > 1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3,gzip(gfe) > See details > > 189.114.129.59 - - [04/May/2010:17:01:10 -0700] "POST /init/ > rotinas/agenda_create HTTP/1.1" 500 394 "http://estetica- > plus.appspot.com/init/rotinas/agenda_create" "Mozilla/5.0 (X11; U; > Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) > Firefox/3.6.3,gzip(gfe)" "estetica-plus.appspot.com" > > 2. > E 05-04 05:01PM 10.668 > > In FILE: /base/data/home/apps/estetica-plus/1.341722964697072247/ > applications/init/controllers/rotinas.py > > Traceback (most recent call last): > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/restricted.py", line 178, in restricted > exec ccode in environment > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > applications/init/controllers/rotinas.py:agenda_create", line 134, in > <module> > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/globals.py", line 96, in <lambda> > self._caller = lambda f: f() > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > applications/init/controllers/rotinas.py:agenda_create", line 69, in > agenda_create > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/tools.py", line 2491, in create > deletable=False, > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/tools.py", line 2435, in update > onvalidation=onvalidation, keepvalues=keepvalues): > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/sqlhtml.py", line 857, in accepts > onvalidation, > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/html.py", line 1311, in accepts > status = self._traverse(status) > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/html.py", line 454, in _traverse > newstatus = c._traverse(status) and newstatus > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/html.py", line 454, in _traverse > newstatus = c._traverse(status) and newstatus > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/html.py", line 454, in _traverse > newstatus = c._traverse(status) and newstatus > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/html.py", line 454, in _traverse > newstatus = c._traverse(status) and newstatus > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/html.py", line 461, in _traverse > newstatus = self._validate() > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/html.py", line 1118, in _validate > (value, errors) = validator(value) > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/validators.py", line 448, in __call__ > rows = self.dbset(field == value).select(limitby=(0, 1)) > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/contrib/gql.py", line 307, in __eq__ > return Query(self, '=', value) > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/contrib/gql.py", line 543, in __init__ > right = dateobj_to_datetime(obj_represent(right, left.type, > left._db)) > File "/base/data/home/apps/estetica-plus/1.341722964697072247/ > gluon/contrib/gql.py", line 465, in obj_represent > str(obj)[11:].strip().split(':')[:3]] > ValueError: invalid literal for int() with base 10: '' > > How to solve this problem ?