Add support for Message class.

This commit is contained in:
Jonathan Frederic 2015-01-22 10:38:11 -08:00
parent 273a8030d9
commit 6eda2d80f9

View File

@ -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,