##// END OF EJS Templates
Fixing url join problems.
Brian E. Granger -
Show More
@@ -33,7 +33,7 b' class NewHandler(IPythonHandler):'
33 @web.authenticated
33 @web.authenticated
34 def get(self):
34 def get(self):
35 notebook_id = self.notebook_manager.new_notebook()
35 notebook_id = self.notebook_manager.new_notebook()
36 self.redirect('/' + url_path_join(self.base_project_url, notebook_id))
36 self.redirect(url_path_join(self.base_project_url, notebook_id))
37
37
38
38
39 class NamedNotebookHandler(IPythonHandler):
39 class NamedNotebookHandler(IPythonHandler):
@@ -60,7 +60,7 b' class NotebookRedirectHandler(IPythonHandler):'
60 notebook_name = os.path.splitext(notebook_name)[0]
60 notebook_name = os.path.splitext(notebook_name)[0]
61 notebook_id = self.notebook_manager.rev_mapping.get(notebook_name, '')
61 notebook_id = self.notebook_manager.rev_mapping.get(notebook_name, '')
62 if notebook_id:
62 if notebook_id:
63 url = self.settings.get('base_project_url', '/') + notebook_id
63 url = url_path_join(self.settings.get('base_project_url', '/'), notebook_id)
64 return self.redirect(url)
64 return self.redirect(url)
65 else:
65 else:
66 raise HTTPError(404)
66 raise HTTPError(404)
@@ -71,5 +71,5 b' class NotebookCopyHandler(IPythonHandler):'
71 @web.authenticated
71 @web.authenticated
72 def get(self, notebook_id):
72 def get(self, notebook_id):
73 notebook_id = self.notebook_manager.copy_notebook(notebook_id)
73 notebook_id = self.notebook_manager.copy_notebook(notebook_id)
74 self.redirect('/'+url_path_join(self.base_project_url, notebook_id))
74 self.redirect(url_path_join(self.base_project_url, notebook_id))
75
75
@@ -28,4 +28,5 b' def url_path_join(*pieces):'
28 result = '/'.join(s for s in striped if s)
28 result = '/'.join(s for s in striped if s)
29 if initial: result = '/' + result
29 if initial: result = '/' + result
30 if final: result = result + '/'
30 if final: result = result + '/'
31 if result == '//': result = '/'
31 return result
32 return result
General Comments 0
You need to be logged in to leave comments. Login now