I am running web2py version 1.99.3
I have the following code in my default controller. The view shows the
item. When i run
links = [lambda row:
A('Edit',_href=URL("default","sweeps",args=[row.id])),
lambda row:
A('Delete',_href=URL("default","promos",args=[row.id]))]
grid2 = SQLFORM.grid(db.auth_user, links=links)
return dict(item=grid2)
but it blows up with a keyerror on id. I thought my lambda links were
correct, but maybe something has changed or I've gotten it wrong?
Thanks,
David
<type 'exceptions.KeyError'> 'id'
Traceback (most recent call last):
File "/home/watson/latte/web2py/gluon/restricted.py", line 204, in
restricted
exec ccode in environment
File "/home/watson/latte/web2py/applications/latte/controllers/
default.py", line 139, in <module>
File "/home/watson/latte/web2py/gluon/globals.py", line 162, in
<lambda>
self._caller = lambda f: f()
File "/home/watson/latte/web2py/applications/latte/controllers/
default.py", line 45, in apps
(db.portal_keyword.user_id==auth.user_id), links=links,
fields=fields, paginate=10, ui="jquery-ui")
File "/home/watson/latte/web2py/gluon/sqlhtml.py", line 1810, in
grid
if link(row):
File "/home/watson/latte/web2py/applications/latte/controllers/
default.py", line 41, in <lambda>
links = [lambda row:
A('Edit',_href=URL("default","index",args=[row.id])),
File "/home/watson/latte/web2py/gluon/dal.py", line 3948, in
__getattr__
return self[key]
File "/home/watson/latte/web2py/gluon/dal.py", line 3939, in
__getitem__
return dict.__getitem__(self, key)
KeyError: 'id'