[MERGE] fix jsonp courtesy of florent.x
bzr revid: al@openerp.com-20120123004812-ec0548qfmkr0rbk8
This commit is contained in:
commit
2f805ff45e
|
@ -145,21 +145,22 @@ class JsonRequest(WebRequest):
|
|||
jsonp = args.get('jsonp')
|
||||
requestf = None
|
||||
request = None
|
||||
request_id = args.get('id')
|
||||
|
||||
if jsonp and self.httprequest.method == 'POST':
|
||||
# jsonp 2 steps step1 POST: save call
|
||||
self.init(args)
|
||||
req.session.jsonp_requests[args.get('id')] = self.httprequest.form['r']
|
||||
self.session.jsonp_requests[request_id] = self.httprequest.form['r']
|
||||
headers=[('Content-Type', 'text/plain; charset=utf-8')]
|
||||
r = werkzeug.wrappers.Response(request_id, headers=headers)
|
||||
return r
|
||||
elif jsonp and args.get('r'):
|
||||
# jsonp method GET
|
||||
request = args.get('r')
|
||||
elif jsonp and args.get('id'):
|
||||
elif jsonp and request_id:
|
||||
# jsonp 2 steps step2 GET: run and return result
|
||||
self.init(args)
|
||||
request = self.session.jsonp_requests.pop(args.get(id), "")
|
||||
request = self.session.jsonp_requests.pop(request_id, "")
|
||||
else:
|
||||
# regular jsonrpc2
|
||||
requestf = self.httprequest.stream
|
||||
|
|
Loading…
Reference in New Issue