mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Add support for Message class.
This commit is contained in:
parent
273a8030d9
commit
6eda2d80f9
@ -11,6 +11,7 @@ import sys
|
||||
from IPython.utils.traitlets import Unicode, List
|
||||
from IPython.display import clear_output
|
||||
from IPython.testing.skipdoctest import skip_doctest
|
||||
from IPython.kernel.zmq.session import Message
|
||||
|
||||
@skip_doctest
|
||||
class Output(DOMWidget):
|
||||
@ -50,9 +51,9 @@ class Output(DOMWidget):
|
||||
buffers=None, track=False, header=None, metadata=None):
|
||||
|
||||
# Handle both prebuild messages and unbuilt messages.
|
||||
if isinstance(msg_or_type, dict):
|
||||
if isinstance(msg_or_type, (Message, dict)):
|
||||
msg_type = msg_or_type['msg_type']
|
||||
msg = msg_or_type
|
||||
msg = dict(msg_or_type)
|
||||
else:
|
||||
msg_type = msg_or_type
|
||||
msg = session.msg(msg_type, content=content, parent=parent,
|
||||
|
Loading…
Reference in New Issue
Block a user