From 463bcf85ee04dbc54c9e29e78aa3630f33970039 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 7 Jan 2014 15:13:07 -0800 Subject: [PATCH] Fixed _send so it can open a comm if needed. It no longer returns anything. --- IPython/html/widgets/widget.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index b4c934dc9..cec119f19 100644 --- a/IPython/html/widgets/widget.py +++ b/IPython/html/widgets/widget.py @@ -278,7 +278,8 @@ class Widget(LoggingConfigurable): view_name: unicode (optional) View to display in the frontend. Overrides view_name.""" - # Show view. + # Show view. By sending a display message, the comm is opened and the + # initial state is sent. self._send({"method": "display", "view_name": view_name}) self._displayed = True self._handle_displayed(**kwargs) @@ -307,11 +308,7 @@ class Widget(LoggingConfigurable): def _send(self, msg): """Sends a message to the model in the front-end""" - if self._comm is not None: - self._comm.send(msg) - return True - else: - return False + self.comm.send(msg) class DOMWidget(Widget):