diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-07-12 14:07:27 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-07-12 14:07:27 +0200 |
| commit | 17db55200b31494427d26803da93b59be90c239d (patch) | |
| tree | f7b76a8121b314133e012b7fdb63c2abfdc4a823 /addons/web/static/src/js/corelib.js | |
| parent | 12f58092f2df0d7236dbadf346765bcb37ae5929 (diff) | |
| parent | a7ab235c3a88dc817d61c526b9474c5537d5ed61 (diff) | |
[IMP] Modified the way the sessions are handled to easily work with or without cookies
bzr revid: nicolas.vanhoren@openerp.com-20130712120727-z1hj46m7m807nal1
Diffstat (limited to 'addons/web/static/src/js/corelib.js')
| -rw-r--r-- | addons/web/static/src/js/corelib.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index 007a0adc803..3b328fb8765 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -967,6 +967,8 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, { instance.web.PropertiesMixin.init.call(this); this.server = null; this.debug = ($.deparam($.param.querystring()).debug != undefined); + this.override_session = false; + this.session_id = undefined; }, setup: function(origin) { var window_origin = location.protocol+"//"+location.host, self=this; @@ -1009,7 +1011,6 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, { var deferred = $.Deferred(); if (! options.shadow) this.trigger('request', url, payload); - payload.debug = this.debug ? true : false; this.rpc_function(url, payload).then( function (response, textStatus, jqXHR) { @@ -1055,7 +1056,10 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, { dataType: 'json', contentType: 'application/json', data: JSON.stringify(payload), - processData: false + processData: false, + headers: { + "X-Openerp-Session-Id": this.override_session ? this.session_id : undefined, + }, }, url); if (this.synch) ajax.async = false; @@ -1134,11 +1138,10 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, { }, url: function(path, params) { - var qs = ''; - if (!_.isNull(params)) { - params = _.extend(params || {}, {session_id: this.session_id}); - qs = '?' + $.param(params); - } + params = _.extend(params || {}); + if (this.override_session) + params.session_id = this.session_id; + var qs = '?' + $.param(params); var prefix = _.any(['http://', 'https://', '//'], _.bind(_.str.startsWith, null, path)) ? '' : this.prefix; return prefix + path + qs; }, |
