本文整理汇总了Python中user.User.select方法的典型用法代码示例。如果您正苦于以下问题:Python User.select方法的具体用法?Python User.select怎么用?Python User.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: info
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import select [as 别名]
def info(inData):
from user import User
from sensor import Sensor
from station import Station
pureData=Auth.select(inData)
userInfo={}
sensorInfo={}
stationInfo={}
#print(pureData)
for tmp in pureData['data']:
t=tmp['sensorId']
if(not(t in sensorInfo)):
curSensor=Sensor.select({'id': t})
sensorInfo[t]=curSensor
tmp['sensorName']=sensorInfo[t]['data'][0]['name']
t=sensorInfo[t]['data'][0]['stationId']
if(not(t in stationInfo)):
curStation=Station.select({id: t})
stationInfo[t]=curStation
tmp['stationName']=stationInfo[t]['data'][0]['name']
t=tmp['userId']
if(not(t in userInfo)):
curUser=User.select({'id':t})
userInfo[t]=curUser
tmp['userName']=userInfo[t]['data'][0]['username']
return pureData
示例2: info
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import select [as 别名]
def info(inData):
from auth import Auth
pureData=Sensor.select(inData)
stationInfo={}
authInfo={}
userInfo={}
stationQuery=session.query(Station)
authQuery=session.query(Auth)
userQuery=session.query(User)
for tmp in pureData['data']:
t=tmp['stationId']
tmpAllStation=Station.select({'id': int(t)})
if(len(tmpAllStation['data'])==0):
tmp['stationName']='not find'
else:
tmp['stationName']=tmpAllStation['data'][0]['name']
tmpAllAuth=Auth.select({'sensorId': int(tmp['id'])})
if(len(tmpAllAuth['data'])==0):
tmp['username']='not find'
tmp['userId']=-1
else:
tmpAllUser=User.select({'id': int(tmpAllAuth['data'][0]['userId'])})
if(len(tmpAllUser['data'])==0):
tmp['username']='not find'
tmp['userId']=-1
else:
tmp['username']=tmpAllUser['data'][0]['username']
tmp['userId']=tmpAllUser['data'][0]['id']
return pureData
示例3: check_database_for
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import select [as 别名]
def check_database_for(self, meal_name=None, beer_name=None,
category_name=None, user_chat_id=None):
"""Checks the database for various things. Returns truth value."""
if meal_name:
query = Meal.select().where(Meal.name == meal_name)
elif beer_name:
query = Beer.select().where(Beer.name == beer_name)
elif category_name:
query = MealCategory.select().where(MealCategory.name == category_name)
elif user_chat_id:
query = User.select().where(User.chat_id == user_chat_id)
else:
print 'No query specified!'
return False
if len(query) > 0:
return True # return true when results are found
return False
示例4: print
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import select [as 别名]
from user import User
#
ret=User.select({'username': 'jbkj'})
print(ret)
#
# tmp=User.changePw({'id':1, 'newPasswd':'1234', 'newUsername':'asd'})
# print(tmp)
# #
# print(User.verifyUser({'username':'asd', 'passwd':'123'}))
#tmp=User.add('test', '123', 0)
#tmp = User.deleteUser({'updateId':'1', 'delId':'2'})
#tmp = User.check('test')
#print(tmp)
#print(User.verifyUser({'username':'asd', 'passwd':'123'}))