main.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:FSND_Multi_User_Blog 作者: harrystaley 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号