##// END OF EJS Templates
fix bug in test_contentmanager
fix bug in test_contentmanager

File last commit:

r13033:73885466
r13039:8d62cbb2
Show More
handlers.py
92 lines | 2.7 KiB | text/x-python | PythonLexer
Brian E. Granger
Splitting handlers into different files....
r10642 """Tornado handlers for the tree view.
Brian E. Granger
Adding new files.
r10641
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
Brian E. Granger
Splitting handlers into different files....
r10642 # Copyright (C) 2011 The IPython Development Team
Brian E. Granger
Adding new files.
r10641 #
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
MinRK
remove notebook read-only view...
r11644 from tornado import web
from ..base.handlers import IPythonHandler
Brian E. Granger
Adding new files.
r10641
#-----------------------------------------------------------------------------
Brian E. Granger
Splitting handlers into different files....
r10642 # Handlers
Brian E. Granger
Adding new files.
r10641 #-----------------------------------------------------------------------------
class ProjectDashboardHandler(IPythonHandler):
MinRK
remove notebook read-only view...
r11644 @web.authenticated
Brian E. Granger
Adding new files.
r10641 def get(self):
Brian E. Granger
Renaming templates to match other names.
r10651 self.write(self.render_template('tree.html',
Brian E. Granger
Adding new files.
r10641 project=self.project,
project_component=self.project.split('/'),
Zachary Sailer
fixing broken links from recent changes....
r13033 notebook_path= "/"
Brian E. Granger
Adding new files.
r10641 ))
Brian E. Granger
More work on the handlers
r10647
Zachary Sailer
manual rebase tree/handlers.py
r12990 class ProjectPathDashboardHandler(IPythonHandler):
Zachary Sailer
rebase master- eliminate read-only
r13014 @web.authenticated
Zachary Sailer
manual rebase tree/handlers.py
r12990 def get(self, notebook_path):
nbm = self.notebook_manager
name, path = nbm.named_notebook_path(notebook_path)
Zachary Sailer
fixing broken links from recent changes....
r13033 if name is not None:
Paul Ivanov
use new assumptions for named_notebook_path
r13030 # ends with .ipynb
self.redirect(self.base_project_url + 'notebooks' + path + name)
Zachary Sailer
manual rebase tree/handlers.py
r12990 else:
Paul Ivanov
use new assumptions for named_notebook_path
r13030 project = self.project + path
Zachary Sailer
allow spaces in notebook path
r13012 path = nbm.url_encode(path)
Zachary Sailer
manual rebase tree/handlers.py
r12990 self.write(self.render_template('tree.html',
project=project,
Zachary Sailer
fixing broken links from recent changes....
r13033 project_component=project.split('/')[:-1],
Zachary Sailer
manual rebase tree/handlers.py
r12990 notebook_path=path,
Paul Ivanov
use new assumptions for named_notebook_path
r13030 notebook_name=name))
Zachary Sailer
manual rebase tree/handlers.py
r12990
class TreeRedirectHandler(IPythonHandler):
Zachary Sailer
rebase master- eliminate read-only
r13014 @web.authenticated
Zachary Sailer
manual rebase tree/handlers.py
r12990 def get(self):
url = self.base_project_url + 'tree'
self.redirect(url)
Zachary Sailer
fixing path redirects, cleaning path logic
r12992 class TreePathRedirectHandler(IPythonHandler):
Zachary Sailer
rebase master- eliminate read-only
r13014 @web.authenticated
Zachary Sailer
fixing path redirects, cleaning path logic
r12992 def get(self, notebook_path):
Zachary Sailer
fixing broken links from recent changes....
r13033 url = self.base_project_url + 'tree/'+ notebook_path+'/'
Zachary Sailer
fixing path redirects, cleaning path logic
r12992 self.redirect(url)
Zachary Sailer
manual rebase tree/handlers.py
r12990 class ProjectRedirectHandler(IPythonHandler):
Zachary Sailer
rebase master- eliminate read-only
r13014 @web.authenticated
Zachary Sailer
manual rebase tree/handlers.py
r12990 def get(self):
url = self.base_project_url + 'tree'
self.redirect(url)
Zachary Sailer
added folder creation ability using '/-new'
r13003
Brian E. Granger
More work on the handlers
r10647 #-----------------------------------------------------------------------------
# URL to handler mappings
#-----------------------------------------------------------------------------
Zachary Sailer
manual rebase tree/handlers.py
r12990 _notebook_path_regex = r"(?P<notebook_path>.+)"
default_handlers = [
Zachary Sailer
fixing broken links from recent changes....
r13033 (r"/tree/%s/" % _notebook_path_regex, ProjectPathDashboardHandler),
(r"/tree/%s" % _notebook_path_regex, TreePathRedirectHandler),
Zachary Sailer
manual rebase tree/handlers.py
r12990 (r"/tree", ProjectDashboardHandler),
(r"/tree/", TreeRedirectHandler),
(r"/", ProjectRedirectHandler)
]