mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Remove redundent _handle_close method
This commit is contained in:
parent
857ae831fb
commit
996d133710
@ -426,18 +426,16 @@ class Widget(LoggingConfigurable):
|
|||||||
if not hasattr(self, '_comm') or self._comm is None:
|
if not hasattr(self, '_comm') or self._comm is None:
|
||||||
self._comm = Comm(target_name=self.target_name)
|
self._comm = Comm(target_name=self.target_name)
|
||||||
self._comm.on_msg(self._handle_msg)
|
self._comm.on_msg(self._handle_msg)
|
||||||
self._comm.on_close(self._handle_close)
|
self._comm.on_close(self._close_communication)
|
||||||
|
|
||||||
|
|
||||||
def _handle_close(self):
|
|
||||||
"""Called when the comm is closed by the front-end."""
|
|
||||||
self._close_communication()
|
|
||||||
|
|
||||||
|
|
||||||
def _close_communication(self):
|
def _close_communication(self):
|
||||||
"""Closes a communication with the front-end."""
|
"""Closes a communication with the front-end."""
|
||||||
if hasattr(self, '_comm') and self._comm is not None:
|
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):
|
def _send(self, msg):
|
||||||
|
Loading…
Reference in New Issue
Block a user