本文整理匯總了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')