From f8e5e96271c17a9749f9e48fae7c4fad1a700b53 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 23 Nov 2009 13:14:00 +0100 Subject: [PATCH] Introduce new HomeHandler. --- application/__init__.py | 3 ++- application/handlers.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/application/__init__.py b/application/__init__.py index 8fb9dba..79e02a1 100644 --- a/application/__init__.py +++ b/application/__init__.py @@ -7,7 +7,7 @@ import tornado.web BASEDIR = os.path.join(os.path.dirname(__file__), "..") from auth import LoginHandler, LogoutHandler -from handlers import MainHandler +from handlers import HomeHandler, MainHandler class Application(tornado.web.Application): def __init__(self): @@ -22,6 +22,7 @@ class Application(tornado.web.Application): handlers = [ (r"/", MainHandler), + (r"/home", HomeHandler), (r"/login", LoginHandler), (r"/logout", LogoutHandler), ] #self.get_handlers() diff --git a/application/handlers.py b/application/handlers.py index 0c6a73c..48f56fa 100644 --- a/application/handlers.py +++ b/application/handlers.py @@ -11,11 +11,16 @@ class BaseHandler(tornado.web.RequestHandler): def footer(self): return "%s" % socket.gethostname() + class MainHandler(BaseHandler): def get(self): if not self.current_user: self.redirect("/login") return + self.redirect("/home") + +class HomeHandler(BaseHandler): + def get(self): self.render("template.html", title="Testsite", slogan="Security now!", footer=self.footer(), user=self.current_user) -- 2.47.3