##// END OF EJS Templates
Enable codemirror search/replace shortcuts
Enable codemirror search/replace shortcuts

File last commit:

r19011:82765a7d
r19014:087e6144
Show More
handlers.py
26 lines | 853 B | text/x-python | PythonLexer
Thomas Kluyver
Basic infrastructure for new texteditor component
r19010 #encoding: utf-8
"""Tornado handlers for the terminal emulator."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
from ..base.handlers import IPythonHandler, file_path_regex
Thomas Kluyver
Loading a file works
r19011 from ..utils import url_escape
Thomas Kluyver
Basic infrastructure for new texteditor component
r19010
class EditorHandler(IPythonHandler):
"""Render the terminal interface."""
@web.authenticated
def get(self, path, name):
Thomas Kluyver
Loading a file works
r19011 path = path.strip('/')
if not self.contents_manager.file_exists(name, path):
raise web.HTTPError(404, u'File does not exist: %s/%s' % (path, name))
file_path = url_escape(path) + "/" + url_escape(name)
self.write(self.render_template('texteditor.html',
file_path=file_path,
)
)
Thomas Kluyver
Basic infrastructure for new texteditor component
r19010
default_handlers = [
(r"/texteditor%s" % file_path_regex, EditorHandler),
]