notebook/IPython/html/terminal/handlers.py

29 lines
861 B
Python
Raw Normal View History

#encoding: utf-8
2014-09-30 08:59:54 +08:00
"""Tornado handlers for the terminal emulator."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
2014-10-26 08:10:41 +08:00
import tornado
2014-09-30 08:59:54 +08:00
from tornado import web
import terminado
2014-09-30 08:59:54 +08:00
from ..base.handlers import IPythonHandler
class TerminalHandler(IPythonHandler):
"""Render the terminal interface."""
2014-09-30 08:59:54 +08:00
@web.authenticated
def get(self, term_name):
self.write(self.render_template('terminal.html',
ws_path="terminals/websocket/%s" % term_name))
2014-09-30 08:59:54 +08:00
class TermSocket(terminado.TermSocket, IPythonHandler):
def get(self, *args, **kwargs):
if not self.get_current_user():
raise web.HTTPError(403)
return super(TermSocket, self).get(*args, **kwargs)
def clear_cookie(self, *args, **kwargs):
"""meaningless for websockets"""
pass
2014-10-26 08:10:41 +08:00