##// END OF EJS Templates
Adds configuration options to use Google Drive content manager...
Adds configuration options to use Google Drive content manager Adds the key contentmanager_js_source to webapp_settings that allows for specifying the content manager JavaScript source file. Also adds a NotebookManager subclass, ClientSideNotebookManager, which does minimal logic. This class is used when the JavaScript content manager doesn't use the Python notebook manager, but rather implements that logic client side, as is the case for the Google Drive based content manager. A sample command line that uses the Google Drive content manager, and the ClientSideNotebookManager, is ipython notebook --NotebookApp.webapp_settings="{'contentmanager_js_source': 'base/js/drive_contentmanager'}" --NotebookApp.notebook_manager_class="IPython.html.services.notebooks.clientsidenbmanager.ClientSideNotebookManager"

File last commit:

r18546:2b2243ed
r18639:28c27a69
Show More
handlers.py
48 lines | 1.5 KiB | text/x-python | PythonLexer
#encoding: utf-8
"""Tornado handlers for the terminal emulator."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import tornado
from tornado import web
import terminado
from ..base.handlers import IPythonHandler
class TerminalHandler(IPythonHandler):
"""Render the terminal interface."""
@web.authenticated
def get(self, term_name):
self.write(self.render_template('terminal.html',
ws_path="terminals/websocket/%s" % term_name))
class NewTerminalHandler(IPythonHandler):
"""Redirect to a new terminal."""
@web.authenticated
def get(self):
name, _ = self.application.terminal_manager.new_named_terminal()
self.redirect(name, permanent=False)
class TermSocket(terminado.TermSocket, IPythonHandler):
def get(self, *args, **kwargs):
if not self.get_current_user():
raise web.HTTPError(403)
# FIXME: only do super get on tornado ≥ 4
# tornado 3 has no get, will raise 405
if tornado.version_info >= (4,):
return super(TermSocket, self).get(*args, **kwargs)
def clear_cookie(self, *args, **kwargs):
"""meaningless for websockets"""
pass
def open(self, *args, **kwargs):
if tornado.version_info < (4,):
try:
self.get(*self.open_args, **self.open_kwargs)
except web.HTTPError:
self.close()
raise
super(TermSocket, self).open(*args, **kwargs)