I simply wanted to serialize all the fields of a submitted form, like this in PHP:
json_encode($_GET)
json.dumps(self.request.get) doesn’t work:
<type 'exceptions.TypeError'>: <bound method Request.get of <Request at 77ea190 GET http://localhost:8083/?a=value>> is not JSON serializable
args = ('<bound method Request.get of <Request at 77ea190...ocalhost:8083/?a=value>> is not JSON serializable',)
message = '<bound method Request.get of <Request at 77ea190...ocalhost:8083/?a=value>> is not JSON serializable'
I’ve tried using the CGI module and that too gives a not serializable error. I case you wondering: I use this to send data back to my template to repopulate the form fields.
self.request.getreturns thegetmethod, not what the methods return. You have to do this:request.GETwill return aUnicodeMultiDictobject, andrequest.GET.items()will return a list of tuples, each tuples being(key, value).Cf. http://code.google.com/appengine/docs/python/tools/webapp/requestclass.html and http://docs.webob.org/en/latest/reference.html#id1