From ade7692ccda8368079a39e72bdb9727137ad7748 Mon Sep 17 00:00:00 2001 From: "Jessica B. Hamrick" Date: Wed, 1 Oct 2014 00:34:18 -0700 Subject: [PATCH] Fix bugs in kernel.js --- .../html/static/services/kernels/js/kernel.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/IPython/html/static/services/kernels/js/kernel.js b/IPython/html/static/services/kernels/js/kernel.js index eaaf6c335..8034e3e33 100644 --- a/IPython/html/static/services/kernels/js/kernel.js +++ b/IPython/html/static/services/kernels/js/kernel.js @@ -158,7 +158,7 @@ define([ cache: false, type: "DELETE", dataType: "json", - success: this._on_success(success), + success: this._on_success(on_success), error: this._on_error(error) }); }; @@ -193,12 +193,6 @@ define([ success(data, status, xhr); } }; - var on_error = function (xhr, status, err) { - that._handle_start_failure(xhr, status, err); - if (error) { - error(xhr, status, err); - } - }; var url = utils.url_join_encode(this.kernel_url, 'restart'); $.ajax(url, { @@ -206,7 +200,7 @@ define([ cache: false, type: "POST", dataType: "json", - success: this._on_success(success), + success: this._on_success(on_success), error: this._on_error(error) }); }; @@ -214,8 +208,10 @@ define([ Kernel.prototype._on_success = function (success) { var that = this; return function (data, status, xhr) { - that.id = data.id; - that.name = data.name; + if (data) { + that.id = data.id; + that.name = data.name; + } that.kernel_url = utils.url_join_encode(that.kernel_service_url, that.id); if (success) { success(data, status, xhr);