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