Show More
@@ -123,6 +123,14 b' def authenticate_unless_readonly(f, self, *args, **kwargs):' | |||||
123 | else: |
|
123 | else: | |
124 | return auth_f(self, *args, **kwargs) |
|
124 | return auth_f(self, *args, **kwargs) | |
125 |
|
125 | |||
|
126 | def urljoin(*pieces): | |||
|
127 | """Join componenet of url into a relative url | |||
|
128 | ||||
|
129 | Use to prevent double slash when joining subpath | |||
|
130 | """ | |||
|
131 | striped = [s.strip('/') for s in pieces] | |||
|
132 | return '/'.join(s for s in striped if s) | |||
|
133 | ||||
126 | #----------------------------------------------------------------------------- |
|
134 | #----------------------------------------------------------------------------- | |
127 | # Top-level handlers |
|
135 | # Top-level handlers | |
128 | #----------------------------------------------------------------------------- |
|
136 | #----------------------------------------------------------------------------- | |
@@ -267,17 +275,7 b' class NewHandler(AuthenticatedHandler):' | |||||
267 | nbm = self.application.notebook_manager |
|
275 | nbm = self.application.notebook_manager | |
268 | project = nbm.notebook_dir |
|
276 | project = nbm.notebook_dir | |
269 | notebook_id = nbm.new_notebook() |
|
277 | notebook_id = nbm.new_notebook() | |
270 | self.render( |
|
278 | self.redirect('/'+urljoin(self.application.ipython_app.base_project_url, notebook_id)) | |
271 | 'notebook.html', project=project, |
|
|||
272 | notebook_id=notebook_id, |
|
|||
273 | base_project_url=self.application.ipython_app.base_project_url, |
|
|||
274 | base_kernel_url=self.application.ipython_app.base_kernel_url, |
|
|||
275 | kill_kernel=False, |
|
|||
276 | read_only=False, |
|
|||
277 | logged_in=self.logged_in, |
|
|||
278 | login_available=self.login_available, |
|
|||
279 | mathjax_url=self.application.ipython_app.mathjax_url, |
|
|||
280 | ) |
|
|||
281 |
|
279 | |||
282 |
|
280 | |||
283 | class NamedNotebookHandler(AuthenticatedHandler): |
|
281 | class NamedNotebookHandler(AuthenticatedHandler): | |
@@ -663,17 +661,7 b' class NotebookCopyHandler(AuthenticatedHandler):' | |||||
663 | nbm = self.application.notebook_manager |
|
661 | nbm = self.application.notebook_manager | |
664 | project = nbm.notebook_dir |
|
662 | project = nbm.notebook_dir | |
665 | notebook_id = nbm.copy_notebook(notebook_id) |
|
663 | notebook_id = nbm.copy_notebook(notebook_id) | |
666 | self.render( |
|
664 | self.redirect('/'+urljoin(self.application.ipython_app.base_project_url, notebook_id)) | |
667 | 'notebook.html', project=project, |
|
|||
668 | notebook_id=notebook_id, |
|
|||
669 | base_project_url=self.application.ipython_app.base_project_url, |
|
|||
670 | base_kernel_url=self.application.ipython_app.base_kernel_url, |
|
|||
671 | kill_kernel=False, |
|
|||
672 | read_only=False, |
|
|||
673 | logged_in=self.logged_in, |
|
|||
674 | login_available=self.login_available, |
|
|||
675 | mathjax_url=self.application.ipython_app.mathjax_url, |
|
|||
676 | ) |
|
|||
677 |
|
665 | |||
678 |
|
666 | |||
679 | #----------------------------------------------------------------------------- |
|
667 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now