diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index e71f451..f722997 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -2103,11 +2103,10 @@ define([ this.notebook_path = notebook_path; this.notebook_name = utils.url_path_split(this.notebook_path)[1]; this.events.trigger('notebook_loading.Notebook'); - this.contents.get(notebook_path, { - type: 'notebook', - success: $.proxy(this.load_notebook_success, this), - error: $.proxy(this.load_notebook_error, this) - }); + this.contents.get(notebook_path, {type: 'notebook'}).then( + $.proxy(this.load_notebook_success, this), + $.proxy(this.load_notebook_error, this) + ); }; /** diff --git a/IPython/html/static/services/contents.js b/IPython/html/static/services/contents.js index c52bd0d..2528b7d 100644 --- a/IPython/html/static/services/contents.js +++ b/IPython/html/static/services/contents.js @@ -83,14 +83,12 @@ define([ cache : false, type : "GET", dataType : "json", - success : options.success, - error : this.create_basic_error_handler(options.error) }; var url = this.api_url(path); params = {}; if (options.type) { params.type = options.type; } if (options.format) { params.format = options.format; } - $.ajax(url + '?' + $.param(params), settings); + return utils.promising_ajax(url + '?' + $.param(params), settings); }; @@ -246,9 +244,8 @@ define([ * @param {String} path The path to list notebooks in * @param {Object} options including success and error callbacks */ - Contents.prototype.list_contents = function(path, options) { - options.type = 'directory'; - this.get(path, options); + Contents.prototype.list_contents = function(path) { + return this.get(path, {type: 'directory'}); }; diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js index fbc0091..58ffc4d 100644 --- a/IPython/html/static/tree/js/notebooklist.js +++ b/IPython/html/static/tree/js/notebooklist.js @@ -142,12 +142,12 @@ define([ NotebookList.prototype.load_list = function () { var that = this; - this.contents.list_contents(that.notebook_path, { - success: $.proxy(this.draw_notebook_list, this), - error: function(error) { + this.contents.list_contents(that.notebook_path).then( + $.proxy(this.draw_notebook_list, this), + function(error) { that.draw_notebook_list({content: []}, "Server error: " + error.message); } - }); + ); }; /**