Hi,
I have followed your tutorial for the RESTful api.
I am getting the following error though on POST.
Here is the code snippet:
* def POST(table_name,**vars):*
* return db[table_name].validate_and_insert(**vars)*
Here is the db model
* db.define_table("entries", Field("entry", "text"))*
And here is the way I call it
curl -d "entry=322332" http://127.0.0.1:8080/api/default/api/entries.json
The database operation works just fine. I see the entry created in the
table.
But I would like the script to return the id of the created entry and it is
right now throwing an exception instead.
This is for the Google App Engine developer environment of Web2Py.
marcos-mbp:google_appengine marco$
marcos-mbp:google_appengine marco$ python dev_appserver.py ../web2py-3
INFO 2014-08-04 15:47:46,373 sdk_update_checker.py:242] Checking for
updates to the SDK.
WARNING 2014-08-04 15:47:46,731 api_server.py:383] Could not initialize
images API; you are likely missing the Python "PIL" module.
INFO 2014-08-04 15:47:46,736 api_server.py:171] Starting API server at:
http://localhost:51723
INFO 2014-08-04 15:47:46,746 dispatcher.py:182] Starting module
"default" running at: http://localhost:8080
INFO 2014-08-04 15:47:46,755 admin_server.py:117] Starting admin server
at: http://localhost:8000
INFO 2014-08-04 15:48:36,673 gaehandler.py:75] **** Request:
140.07ms/123.83ms (real time/cpu time)
ERROR 2014-08-04 15:48:36,674 cgi.py:121] Traceback (most recent call
last):
File "/Users/marco/Downloads/web2py-3/gaehandler.py", line 112, in
<module>
main()
File "/Users/marco/Downloads/web2py-3/gaehandler.py", line 109, in main
run_wsgi_app(wsgiapp)
File
"/Users/marco/Downloads/google_appengine/google/appengine/ext/webapp/util.py",
line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File
"/Users/marco/Downloads/google_appengine/google/appengine/ext/webapp/util.py",
line 123, in run_bare_wsgi_app
result.close()
TypeError: 'NoneType' object is not callable
Any hints would be appreciated.
tks
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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/d/optout.