From e73528c942d0463e7fe6682eff5a761e166e2b74 2014-01-16 10:57:14 From: Jonathan Frederic Date: 2014-01-16 10:57:14 Subject: [PATCH] Fixed _send so it can open a comm if needed. It no longer returns anything. --- diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index b4c934d..cec119f 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):