From d13272cc41b822b1f1b9ac6dbdc1e803cd73f7f9 2015-01-22 18:45:06
From: Jonathan Frederic <jon.freder@gmail.com>
Date: 2015-01-22 18:45:06
Subject: [PATCH] Add support for Message class.

---

diff --git a/IPython/html/widgets/widget_output.py b/IPython/html/widgets/widget_output.py
index afa2021..93851c8 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,