本文整理汇总了Python中models.User.User.user_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.user_name方法的具体用法?Python User.user_name怎么用?Python User.user_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.User.User
的用法示例。
在下文中一共展示了User.user_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_login
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import user_name [as 别名]
def user_login(user_name, password):
conn = g_dbPool.connection()
cur=conn.cursor()
cur.execute("select * from view_user where user_name=%s AND password=%s" , (user_name, password))
#cur.execute("select * from view_user where user_name=\"18621675203\" AND password=\"a0a475cf454cf9a06979034098167b\"")
rows=cur.fetchall()
lstUser = []
for row in rows:
user = User()
user.id = row[0]
user.user_name = row[1]
user.password = row[2]
user.token = row[3]
user.create_time = row[4]
user.expire_time = row[5]
lstUser.append(user)
cur.close()
if (lstUser != None and len(lstUser) >= 1):
userRet = lstUser[0]
userRet = insert_or_update_token(userRet)
return userRet
else:
return None
示例2: set_user_details
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import user_name [as 别名]
def set_user_details(self, un, em, psw, fn=None, ls=None):
user1 = User()
user1.user_name = un
user1.email = em
user1.user_password = psw
user1.first_name = fn
user1.last_name = ls
self.us_list.append(user1)
print self.us_list
return self.us_list
示例3: get_all_user_from_pool
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import user_name [as 别名]
def get_all_user_from_pool():
conn = g_dbPool.connection()
cur=conn.cursor()
SQL="select * from user"
cur.execute(SQL)
rows=cur.fetchall()
lstUser = []
for row in rows:
user = User()
user.id = row[0]
user.user_name = row[1]
user.password = row[2]
lstUser.append(user)
cur.close()
return lstUser