Show More
@@ -1,26 +1,27 | |||
|
1 | 1 | #encoding: utf-8 |
|
2 | 2 | """Tornado handlers for the terminal emulator.""" |
|
3 | 3 | |
|
4 | 4 | # Copyright (c) IPython Development Team. |
|
5 | 5 | # Distributed under the terms of the Modified BSD License. |
|
6 | 6 | |
|
7 | 7 | from tornado import web |
|
8 | 8 | from ..base.handlers import IPythonHandler, path_regex |
|
9 | 9 | from ..utils import url_escape |
|
10 | 10 | |
|
11 | 11 | class EditorHandler(IPythonHandler): |
|
12 | 12 | """Render the text editor interface.""" |
|
13 | 13 | @web.authenticated |
|
14 | 14 | def get(self, path): |
|
15 | 15 | path = path.strip('/') |
|
16 | 16 | if not self.contents_manager.file_exists(path): |
|
17 | 17 | raise web.HTTPError(404, u'File does not exist: %s' % path) |
|
18 | 18 | |
|
19 | 19 | self.write(self.render_template('texteditor.html', |
|
20 | 20 | file_path=url_escape(path), |
|
21 | page_title=path.rsplit('/', 1)[-1] + " (editing)", | |
|
21 | 22 | ) |
|
22 | 23 | ) |
|
23 | 24 | |
|
24 | 25 | default_handlers = [ |
|
25 | 26 | (r"/texteditor%s" % path_regex, EditorHandler), |
|
26 | 27 | ] No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now