diff --git a/IPython/html/static/widgets/js/manager.js b/IPython/html/static/widgets/js/manager.js
index 08058baf8..41a9cfadc 100644
--- a/IPython/html/static/widgets/js/manager.js
+++ b/IPython/html/static/widgets/js/manager.js
@@ -187,7 +187,7 @@ define([
WidgetManager.prototype._handle_comm_open = function (comm, msg) {
// Handle when a comm is opened.
- return this._create_model({model_name: msg.content.data.target_name, comm: comm});
+ return this._create_model({model_name: msg.content.data.model_name, comm: comm});
};
WidgetManager.prototype.create_model = function (model_name, target_name, init_state_callback) {
diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py
index d840d5bac..e4c189dea 100644
--- a/IPython/html/widgets/widget.py
+++ b/IPython/html/widgets/widget.py
@@ -142,7 +142,7 @@ class Widget(LoggingConfigurable):
Widget._call_widget_constructed(self)
if open_comm:
- self.open()
+ self.open()
def __del__(self):
"""Object disposal"""
@@ -165,11 +165,11 @@ class Widget(LoggingConfigurable):
def set_comm(self, comm):
"""Set's the comm of the widget."""
self.comm = comm
- self._model_id = self.model_id
-
- self.comm.on_msg(self._handle_msg)
- Widget.widgets[self.model_id] = self
-
+ self._model_id = self.model_id
+
+ self.comm.on_msg(self._handle_msg)
+ Widget.widgets[self.model_id] = self
+
# first update
self.send_state()
@@ -359,8 +359,8 @@ class Widget(LoggingConfigurable):
if self.comm is not None and name in self.keys:
# Make sure this isn't information that the front-end just sent us.
if self._should_send_property(name, new_value):
- # Send new state to front-end
- self.send_state(key=name)
+ # Send new state to front-end
+ self.send_state(key=name)
def _handle_displayed(self, **kwargs):
"""Called when a view has been displayed for this widget instance"""