##// END OF EJS Templates
Initial REST API for terminals
Initial REST API for terminals

File last commit:

r18482:656f02bc
r18483:93ff19c4
Show More
handlers.py
24 lines | 788 B | text/x-python | PythonLexer
Thomas Kluyver
Basic infrastructure for terminal page
r18480 """Tornado handlers for the terminal emulator."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
Thomas Kluyver
Terminal basically working...
r18481 import terminado
Thomas Kluyver
Basic infrastructure for terminal page
r18480 from ..base.handlers import IPythonHandler
class TerminalHandler(IPythonHandler):
Thomas Kluyver
Multiple terminals and conditional initialisation
r18482 """Render the terminal interface."""
Thomas Kluyver
Basic infrastructure for terminal page
r18480 @web.authenticated
Thomas Kluyver
Multiple terminals and conditional initialisation
r18482 def get(self, term_name):
self.write(self.render_template('terminal.html',
ws_path="terminals/websocket/%s" % term_name))
Thomas Kluyver
Basic infrastructure for terminal page
r18480
Thomas Kluyver
Multiple terminals and conditional initialisation
r18482 class NewTerminalHandler(IPythonHandler):
"""Redirect to a new terminal."""
@web.authenticated
def get(self):
name, _ = self.application.terminal_manager.new_named_terminal()
self.redirect("/terminals/%s" % name, permanent=False)
Thomas Kluyver
Basic infrastructure for terminal page
r18480
Thomas Kluyver
Multiple terminals and conditional initialisation
r18482 TermSocket = terminado.TermSocket