diff options
| author | Christophe Simonis <chs@openerp.com> | 2012-11-08 17:34:58 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@openerp.com> | 2012-11-08 17:34:58 +0100 |
| commit | 6436f75513efd9c4597cb95babfa5dce840237fc (patch) | |
| tree | 19b055be0b820314d18bf616199c6bc197e50e6e /addons/web/static/src/js/coresetup.js | |
| parent | eaa3da915b5c3b22ddaaa2f4e29b1854e748e2f1 (diff) | |
| parent | bbb51923461bf1237cb4f1635381e85008f4fc0e (diff) | |
merge upstream
bzr revid: chs@openerp.com-20121108163458-wk7p4mf7fyh3winl
Diffstat (limited to 'addons/web/static/src/js/coresetup.js')
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 18e6683cb42..76e2bf8002c 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -57,15 +57,15 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess var self = this; // TODO: session store in cookie should be optional this.session_id = this.get_cookie('session_id'); - return this.session_reload().pipe(function(result) { + return this.session_reload().then(function(result) { var modules = instance._modules.join(','); - var deferred = self.rpc('/web/webclient/qweblist', {mods: modules}).pipe(self.do_load_qweb); + var deferred = self.rpc('/web/webclient/qweblist', {mods: modules}).then(self.do_load_qweb); if(self.session_is_valid()) { - return deferred.pipe(function() { return self.load_modules(); }); + return deferred.then(function() { return self.load_modules(); }); } return $.when( deferred, - self.rpc('/web/webclient/bootstrap_translations', {mods: instance._modules}).pipe(function(trans) { + self.rpc('/web/webclient/bootstrap_translations', {mods: instance._modules}).then(function(trans) { instance.web._t.database.set_bundle(trans); }) ); @@ -79,7 +79,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess */ session_reload: function () { var self = this; - return this.rpc("/web/session/get_session_info", {}).then(function(result) { + return this.rpc("/web/session/get_session_info", {}).done(function(result) { // If immediately follows a login (triggered by trying to restore // an invalid session or no session at all), refresh session data // (should not change, but just in case...) @@ -102,7 +102,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess var self = this; var base_location = document.location.protocol + '//' + document.location.host; var params = { db: db, login: login, password: password, base_location: base_location }; - return this.rpc("/web/session/authenticate", params).pipe(function(result) { + return this.rpc("/web/session/authenticate", params).then(function(result) { if (!result.uid) { return $.Deferred().reject(); } @@ -160,30 +160,30 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess */ load_modules: function() { var self = this; - return this.rpc('/web/session/modules', {}).pipe(function(result) { + return this.rpc('/web/session/modules', {}).then(function(result) { var lang = self.user_context.lang, all_modules = _.uniq(self.module_list.concat(result)); var params = { mods: all_modules, lang: lang}; var to_load = _.difference(result, self.module_list).join(','); self.module_list = all_modules; - var loaded = self.rpc('/web/webclient/translations', params).then(function(trans) { + var loaded = self.rpc('/web/webclient/translations', params).done(function(trans) { instance.web._t.database.set_bundle(trans); }); var file_list = ["/web/static/lib/datejs/globalization/" + lang.replace("_", "-") + ".js"]; if(to_load.length) { loaded = $.when( loaded, - self.rpc('/web/webclient/csslist', {mods: to_load}).then(self.do_load_css), - self.rpc('/web/webclient/qweblist', {mods: to_load}).pipe(self.do_load_qweb), - self.rpc('/web/webclient/jslist', {mods: to_load}).then(function(files) { + self.rpc('/web/webclient/csslist', {mods: to_load}).done(self.do_load_css), + self.rpc('/web/webclient/qweblist', {mods: to_load}).then(self.do_load_qweb), + self.rpc('/web/webclient/jslist', {mods: to_load}).done(function(files) { file_list = file_list.concat(files); }) ); } - return loaded.pipe(function () { + return loaded.then(function () { return self.do_load_js(file_list); - }).then(function() { + }).done(function() { self.on_modules_loaded(); self.trigger('module_loaded'); if (!Date.CultureInfo.pmDesignator) { @@ -218,7 +218,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess if ( (tag.readyState && tag.readyState != "loaded" && tag.readyState != "complete") || tag.onload_done ) return; tag.onload_done = true; - self.do_load_js(files).then(function () { + self.do_load_js(files).done(function () { d.resolve(); }); }; @@ -233,7 +233,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess var self = this; _.each(files, function(file) { self.qweb_mutex.exec(function() { - return self.rpc('/web/proxy/load', {path: file}).pipe(function(xml) { + return self.rpc('/web/proxy/load', {path: file}).then(function(xml) { if (!xml) { return; } instance.web.qweb.add_template(_.str.trim(xml)); }); @@ -468,7 +468,7 @@ $.Mutex = (function() { Mutex.prototype.exec = function(action) { var current = this.def; var next = this.def = $.Deferred(); - return current.pipe(function() { + return current.then(function() { return $.when(action()).always(function() { next.resolve(); }); @@ -480,7 +480,7 @@ $.Mutex = (function() { $.async_when = function() { var async = false; var def = $.Deferred(); - $.when.apply($, arguments).then(function() { + $.when.apply($, arguments).done(function() { var args = arguments; var action = function() { def.resolve.apply(def, args); @@ -489,7 +489,7 @@ $.async_when = function() { action(); else setTimeout(action, 0); - }, function() { + }).fail(function() { var args = arguments; var action = function() { def.reject.apply(def, args); |
