[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')
|
jsonp = args.get('jsonp')
|
||||||
requestf = None
|
requestf = None
|
||||||
request = None
|
request = None
|
||||||
|
request_id = args.get('id')
|
||||||
|
|
||||||
if jsonp and self.httprequest.method == 'POST':
|
if jsonp and self.httprequest.method == 'POST':
|
||||||
# jsonp 2 steps step1 POST: save call
|
# jsonp 2 steps step1 POST: save call
|
||||||
self.init(args)
|
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')]
|
headers=[('Content-Type', 'text/plain; charset=utf-8')]
|
||||||
r = werkzeug.wrappers.Response(request_id, headers=headers)
|
r = werkzeug.wrappers.Response(request_id, headers=headers)
|
||||||
return r
|
return r
|
||||||
elif jsonp and args.get('r'):
|
elif jsonp and args.get('r'):
|
||||||
# jsonp method GET
|
# jsonp method GET
|
||||||
request = args.get('r')
|
request = args.get('r')
|
||||||
elif jsonp and args.get('id'):
|
elif jsonp and request_id:
|
||||||
# jsonp 2 steps step2 GET: run and return result
|
# jsonp 2 steps step2 GET: run and return result
|
||||||
self.init(args)
|
self.init(args)
|
||||||
request = self.session.jsonp_requests.pop(args.get(id), "")
|
request = self.session.jsonp_requests.pop(request_id, "")
|
||||||
else:
|
else:
|
||||||
# regular jsonrpc2
|
# regular jsonrpc2
|
||||||
requestf = self.httprequest.stream
|
requestf = self.httprequest.stream
|
||||||
|
|
Loading…
Reference in New Issue