Thank's a lot for you advice. On 29 nov, 12:56, mdipierro <mdipie...@cs.depaul.edu> wrote: > I do not think there is an error in your code. You have a lot of > > {{=table[nota.field].otherfield}} > > One of these may be failing if note.field references a record that no > longer exist. Try instead > > {{=table[nota.field].otherfield if table[nota.field] else > 'undefined'}} > > Anyway, this code does a lot of DB access. I assume you are running on > GAE. if not, you should use a join instead. > > On Nov 29, 12:29 pm, drayco <antrod...@gmail.com> wrote: > > > This is my function > > > @auth.requires_membership('Capturista') > > def lee_notas(): > > if len(request.args): page=int(request.args[0]) > > else: page=0 > > items_per_page=25 > > limitby=(page*items_per_page,(page+1)*items_per_page+1) > > Capturista = db(db.capturistas.creadoPor==auth.user.id).select() > > notas=db((db.notas.entregado==False)& > > (db.notas.vendedor==db.vendedores.id)& > > (db.vendedores.regional==Capturista[0].regional)).select > > (db.notas.id,db.notas.nota, \ > > > db.notas.folio,db.notas.armazon1,db.notas.lente1,db.notas.lc4,db.notas.total,db.notas.anticipo,db.notas.pago,db.notas.saldo,db.notas.vendedor,db.notas.optometrista,db.notas.creadoEl,orderby=~db.notas.nota,limitby=limitby) > > return dict(notas=notas,page=page,items_per_page=items_per_page) > > > This is my view > > > {{extend 'layout.html'}} > > <h4>Notas de Óptica Luz</h4> > > [ {{=A('Crear 1(una) Nota de Venta', _href=URL(r=request, > > f='crea_nota'))}} ] > > <ul>{{for i,nota in enumerate(notas):}} > > {{if i==items_per_page: break}} > > {{=LI(A('Nota ',nota.nota,' Folio ',nota.folio,' [',db.armazones > > [nota.armazon1].marca,' ',db.armazones[nota.armazon1].caract1,' & > > ',db.lentes[nota.lente1].material,' ',db.lentes[nota.lente1].tipo,' > > ',db.lentes[nota.lente1].tecnoVisual,' ',db.lentes > > [nota.lente1].tratamiento,'] <',db.lentesContacto[nota.lc4].marca,'> T > > $',nota.total,' - A$',nota.anticipo,' - P$',nota.pago,' = S > > $',nota.saldo,' {',db.vendedores[nota.vendedor].names,' & > > ',db.optometristas[nota.optometrista].names,'}',' del ',nota.creadoEl, > > _href=URL(r=request, f='show_nota', args=nota.id)))}} > > {{pass}}</ul> > > {{if page:}} > > <a href="{{=URL(r=request,args=[page-1])}}">Anterior</a> > > {{pass}} > > {{if len(notas)>items_per_page:}} > > <a href="{{=URL(r=request,args=[page+1])}}">Siguiente</a> > > {{pass}} > > > When items_per_page=25 everything is ok > > When I put items_per_page=50 Web2py give me this error: > > > Traceback (most recent call last): > > File "/media/RESPALDO/web2py/gluon/restricted.py", line 184, in > > restricted > > exec ccode in environment > > File "/media/RESPALDO/web2py/applications/seccion36/views/default/ > > lee_notas.html", line 38, in <module> > > File "/media/RESPALDO/web2py/gluon/globals.py", line 112, in write > > self.body.write(xmlescape(data)) > > File "/media/RESPALDO/web2py/gluon/html.py", line 103, in xmlescape > > return data.xml() > > File "/media/RESPALDO/web2py/gluon/html.py", line 517, in xml > > (fa, co) = self._xml() > > File "/media/RESPALDO/web2py/gluon/html.py", line 508, in _xml > > self.components]) > > File "/media/RESPALDO/web2py/gluon/html.py", line 103, in xmlescape > > return data.xml() > > File "/media/RESPALDO/web2py/gluon/html.py", line 517, in xml > > (fa, co) = self._xml() > > File "/media/RESPALDO/web2py/gluon/html.py", line 508, in _xml > > self.components]) > > File "/media/RESPALDO/web2py/gluon/html.py", line 103, in xmlescape > > return data.xml() > > File "/media/RESPALDO/web2py/gluon/sql.py", line 1370, in > > __getattr__ > > self.__allocate() > > File "/media/RESPALDO/web2py/gluon/sql.py", line 1365, in __allocate > > raise Exception, "undefined record" > > Exception: undefined record
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.