[web2py] type 'exceptions.KeyError' 'id'

2012-11-07 Thread Mike Anson

Greetings...

I have a bash script that uses cURL to send a json packet of data in order 
to save it in sqlite DB.

#!/bin/bash
message=$1
uid=$2
url=https://somehost;
curl -v -k -X POST -H Content-Type: application/json --data 
{\message\: \This will prbbly be my lst post.\, \uid\: 
\m...@email.com\} $url

** message and uid are hardcoded at this point but will take the values 
dynamically once I see it working.

Here is my table defined:

db.define_table('messages',
Field https://apps00.cs.lldns.net:8000/examples/global/vars/Field('uid', 
'string'),
Field 
https://apps00.cs.lldns.net:8000/examples/global/vars/Field('message', 
'text'),
Field 
https://apps00.cs.lldns.net:8000/examples/global/vars/Field('status', 
'string', default='unsent'),
Field 
https://apps00.cs.lldns.net:8000/examples/global/vars/Field('added', 
'datetime', default=request 
https://apps00.cs.lldns.net:8000/examples/global/vars/request.now),
Field 
https://apps00.cs.lldns.net:8000/examples/global/vars/Field('modified', 
'datetime', default=request 
https://apps00.cs.lldns.net:8000/examples/global/vars/request.now))

*I've tried many variations of the cURL command and ran in to various errors. 
The above cURL command gives the error: *type 'exceptions.KeyError' 'id'

Any help would be greatly appreciated.

-- 





[web2py] type 'exceptions.KeyError' 'id' on 1.99.3 with SQLFORM.grid and links

2011-12-01 Thread David Watson
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'