From 996d133710cd14f9b1992a5c7344fb0a93a14153 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Fri, 20 Dec 2013 17:22:06 -0800 Subject: [PATCH] Remove redundent _handle_close method --- IPython/html/widgets/widget.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index aaca8c983..6c1f38f48 100644 --- a/IPython/html/widgets/widget.py +++ b/IPython/html/widgets/widget.py @@ -426,18 +426,16 @@ class Widget(LoggingConfigurable): if not hasattr(self, '_comm') or self._comm is None: self._comm = Comm(target_name=self.target_name) self._comm.on_msg(self._handle_msg) - self._comm.on_close(self._handle_close) - - - def _handle_close(self): - """Called when the comm is closed by the front-end.""" - self._close_communication() + self._comm.on_close(self._close_communication) def _close_communication(self): """Closes a communication with the front-end.""" if hasattr(self, '_comm') and self._comm is not None: - self._comm.close() + try: + self._comm.close() + finally: + self._comm = None def _send(self, msg):