def get(self):
""" handles the GET request for welcome.html """
# if the usercookie exists render the welcome page
# otherwise redirect to the signup page.
if self.read_secure_cookie('usercookie'):
# Gets the user id from the cookie
user_id = self.read_secure_cookie('usercookie')
# gets the key for the kind (table)
key = db.Key.from_path('User',
int(user_id),
parent=user_key())
# gets the user data based upon what is passed
# from user_id into key
user = db.get(key)
# renders the welcome page passing in the user name
self.render("welcome.html",
username=user.username)
else:
self.redirect('/signup')
评论列表
文章目录