From 6eda2d80f96c331d8eeb380fe763714cfef2c4e9 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Thu, 22 Jan 2015 10:38:11 -0800 Subject: [PATCH] Add support for Message class. --- IPython/html/widgets/widget_output.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IPython/html/widgets/widget_output.py b/IPython/html/widgets/widget_output.py index afa202118..93851c8fd 100644 --- a/IPython/html/widgets/widget_output.py +++ b/IPython/html/widgets/widget_output.py @@ -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,