##// END OF EJS Templates
Refactor of prompts and the displayhook....
Refactor of prompts and the displayhook. * Renamed CachedOutput to displayhook.DisplayHook. * Added methods that DisplayHook.__call__ uses to do its work. These methods can now be overridden for the ZMQ kernel. * Removed all hooks (result_display and generate_output_prompt) that the outputcache was using. We need to add these back in once we figure out what to do about hooks in general.

File last commit:

r2754:6f2df84b
r2781:775b3992
Show More
displayhook.py
21 lines | 576 B | text/x-python | PythonLexer
import __builtin__
from session import extract_header
class DisplayHook(object):
def __init__(self, session, pub_socket):
self.session = session
self.pub_socket = pub_socket
self.parent_header = {}
def __call__(self, obj):
if obj is None:
return
__builtin__._ = obj
msg = self.session.msg(u'pyout', {u'data':repr(obj)},
parent=self.parent_header)
self.pub_socket.send_json(msg)
def set_parent(self, parent):
self.parent_header = extract_header(parent)