Skip to content
Browse files

Minor changes to handlers.

  • Loading branch information...
1 parent 29cdf0f commit e3e41dc5a580ef742e7ab7102a7651340b29688e @ellisonbg ellisonbg committed with Sep 6, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 IPython/frontend/html/notebook/handlers.py
View
11 IPython/frontend/html/notebook/handlers.py
@@ -41,8 +41,10 @@
class AuthenticatedHandler(web.RequestHandler):
"""A RequestHandler with an authenticated user."""
+
def get_current_user(self):
user_id = self.get_secure_cookie("user")
+ # For now the user_id should not return empty, but it could eventually
if user_id == '':
user_id = 'anonymous'
if user_id is None:
@@ -54,17 +56,19 @@ def get_current_user(self):
class NBBrowserHandler(AuthenticatedHandler):
+
@web.authenticated
def get(self):
nbm = self.application.notebook_manager
project = nbm.notebook_dir
self.render('nbbrowser.html', project=project,
base_project_url=u'/', base_kernel_url=u'/')
+
class LoginHandler(AuthenticatedHandler):
+
def get(self):
- user_id = self.get_secure_cookie("user") or ''
- self.render('login.html', user_id=user_id)
+ self.render('login.html')
def post(self):
pwd = self.get_argument("password", default=u'')
@@ -73,7 +77,9 @@ def post(self):
url = self.get_argument("next", default="/")
self.redirect(url)
+
class NewHandler(AuthenticatedHandler):
+
@web.authenticated
def get(self):
notebook_id = self.application.notebook_manager.new_notebook()
@@ -82,6 +88,7 @@ def get(self):
class NamedNotebookHandler(AuthenticatedHandler):
+
@web.authenticated
def get(self, notebook_id):
nbm = self.application.notebook_manager

0 comments on commit e3e41dc

Please sign in to comment.
Something went wrong with that request. Please try again.