##// END OF EJS Templates
fix topic on displayhook in ZMQShell
MinRK -
Show More
@@ -43,6 +43,7 b' class ZMQShellDisplayHook(DisplayHook):'
43 """A displayhook subclass that publishes data using ZeroMQ. This is intended
43 """A displayhook subclass that publishes data using ZeroMQ. This is intended
44 to work with an InteractiveShell instance. It sends a dict of different
44 to work with an InteractiveShell instance. It sends a dict of different
45 representations of the object."""
45 representations of the object."""
46 topic=None
46
47
47 session = Instance(Session)
48 session = Instance(Session)
48 pub_socket = Instance('zmq.Socket')
49 pub_socket = Instance('zmq.Socket')
@@ -67,6 +68,6 b' class ZMQShellDisplayHook(DisplayHook):'
67 """Finish up all displayhook activities."""
68 """Finish up all displayhook activities."""
68 sys.stdout.flush()
69 sys.stdout.flush()
69 sys.stderr.flush()
70 sys.stderr.flush()
70 self.session.send(self.pub_socket, self.msg)
71 self.session.send(self.pub_socket, self.msg, ident=self.topic)
71 self.msg = None
72 self.msg = None
72
73
@@ -145,6 +145,7 b' class Kernel(Configurable):'
145 )
145 )
146 self.shell.displayhook.session = self.session
146 self.shell.displayhook.session = self.session
147 self.shell.displayhook.pub_socket = self.iopub_socket
147 self.shell.displayhook.pub_socket = self.iopub_socket
148 self.shell.displayhook.topic = self._topic('pyout')
148 self.shell.display_pub.session = self.session
149 self.shell.display_pub.session = self.session
149 self.shell.display_pub.pub_socket = self.iopub_socket
150 self.shell.display_pub.pub_socket = self.iopub_socket
150
151
@@ -183,7 +183,11 b' class ZMQInteractiveShell(InteractiveShell):'
183 dh = self.displayhook
183 dh = self.displayhook
184 # Send exception info over pub socket for other clients than the caller
184 # Send exception info over pub socket for other clients than the caller
185 # to pick up
185 # to pick up
186 exc_msg = dh.session.send(dh.pub_socket, u'pyerr', json_clean(exc_content), dh.parent_header)
186 topic = None
187 if dh.topic:
188 topic = dh.topic.replace(b'pyout', b'pyerr')
189
190 exc_msg = dh.session.send(dh.pub_socket, u'pyerr', json_clean(exc_content), dh.parent_header, ident=topic)
187
191
188 # FIXME - Hack: store exception info in shell object. Right now, the
192 # FIXME - Hack: store exception info in shell object. Right now, the
189 # caller is reading this info after the fact, we need to fix this logic
193 # caller is reading this info after the fact, we need to fix this logic
General Comments 0
You need to be logged in to leave comments. Login now