本文整理汇总了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)
示例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)
示例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)
示例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)