diff --git a/addons/web/common/http.py b/addons/web/common/http.py index ac9b95dcb26..6d4bf1536a2 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -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