当前位置: 首页>>代码示例>>Python>>正文


Python User.check_token方法代码示例

本文整理汇总了Python中models.user.User.check_token方法的典型用法代码示例。如果您正苦于以下问题:Python User.check_token方法的具体用法?Python User.check_token怎么用?Python User.check_token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.user.User的用法示例。


在下文中一共展示了User.check_token方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import check_token [as 别名]
    def get(self):
        template_params = {}

        user = None
        if self.request.cookies.get('our_token'):    #the cookie that should contain the access token!
            user = User.check_token(self.request.cookies.get('our_token'))

        template_params = {}
        if user:
            template_params['user'] = user.username

        if not user:
            self.redirect('/home')

        template_params['histories'] =[]
        histories = History.getHistory()
        for h in histories:
            template_params['histories'].append({
                "date": h.date,
                "symbol": h.symbol,
                "enterprice": h.enterprice,
                "stoplose": h.stoplose,
                "takeprofit": h.takeprofit,
                "profitorloss":h.profitorloss,
                "volume": h.volume,
                "lstype": h.lstype,
                "remarks": h.remarks
            })

        html = template.render("web/templates/history.html", template_params)
        self.response.write(html)
开发者ID:idanbe,项目名称:ForexApp,代码行数:33,代码来源:history.py

示例2: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import check_token [as 别名]
    def get(self):

        template_params = {}

        user = None
        if self.request.cookies.get('our_token'):    #the cookie that should contain the access token!
            user = User.check_token(self.request.cookies.get('our_token'))

        template_params = {}
        if user:
            template_params['user'] = user.username

        if not user:
            self.redirect('/home')

        template_params['alerts'] =[]
        alerts = Alert.getalerts()
        for a in alerts:
            template_params['alerts'].append({
                "date": a.date,
                "symbol": a.symbol,
                "enterprice": a.enterprice,
                "stoplose": a.stoplose,
                "takeprofit": a.takeprofit,
                "volume": a.volume,
                "lstype": a.lstype
            })


        html = template.render("web/templates/alert.html", template_params)
        self.response.write(html)
开发者ID:idanbe,项目名称:ForexApp,代码行数:33,代码来源:alert.py

示例3: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import check_token [as 别名]
    def get(self):
        user = None
        if self.request.cookies.get('our_token'):    #the cookie that should contain the access token!
            user = User.check_token(self.request.cookies.get('our_token'))

        template_params = {}
        if user:
            template_params['user'] = user.username

        html = template.render('web/templates/home.html', template_params)
        self.response.write(html)
开发者ID:idanbe,项目名称:ForexApp,代码行数:13,代码来源:base.py

示例4: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import check_token [as 别名]
    def get(self):
        template_params = {}

        user = None
        if self.request.cookies.get('our_token'):    #the cookie that should contain the access token!
            user = User.check_token(self.request.cookies.get('our_token'))

        template_params = {}
        if user:
            template_params['user'] = user.username

        if not user:
            self.redirect('/home')

        html = template.render("web/templates/risk.html", template_params)
        self.response.write(html)
开发者ID:idanbe,项目名称:ForexApp,代码行数:18,代码来源:risk.py


注:本文中的models.user.User.check_token方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。