本文整理汇总了Python中dao.UserDao.get_user_by_tid方法的典型用法代码示例。如果您正苦于以下问题:Python UserDao.get_user_by_tid方法的具体用法?Python UserDao.get_user_by_tid怎么用?Python UserDao.get_user_by_tid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dao.UserDao
的用法示例。
在下文中一共展示了UserDao.get_user_by_tid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enroll
# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_tid [as 别名]
def enroll(tid, active_code, phone):
user = UserDao.get_user_by_tid(tid)
if not user: return RESPONSE.WRONG_TID
devices = DeviceDao.get_devices_by_user(user)
for device in devices:
if device['phone'] == phone:
if device['active_code'] == active_code:
if device['active'] == True:
return RESPONSE.ALREADY_ACTIVED
device['active'] = True
UserCollection.update({'tid':user['tid']},user)
RESPONSE.ENROLL_SUCCESS['token'] = user['token']
print RESPONSE.ENROLL_SUCCESS['token']
return RESPONSE.ENROLL_SUCCESS
else:
return RESPONSE.WRONG_ACTIVE_CODE
return RESPONSE.WRONG_PHONE
示例2: test_get_user_by_tid
# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_tid [as 别名]
def test_get_user_by_tid():
user = UserDao.get_user_by_email(email)
user2 = UserDao.get_user_by_tid(user['tid'])
assert user2['email'] == email
示例3: prepare
# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_tid [as 别名]
def prepare(self):
tid = self.get_secure_cookie("tid")
self.user = UserDao.get_user_by_tid(tid) if tid else None
if not self.user: self.redirect('user/login')