本文整理汇总了Python中model.user.User.get_uid方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_uid方法的具体用法?Python User.get_uid怎么用?Python User.get_uid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.get_uid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_user_info
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_uid [as 别名]
def save_user_info(self, cmd_params):
username = cmd_params['username']['value']
password = cmd_params['password']['value']
experience = cmd_params['experience']['value']
level = cmd_params['level']['value']
user = User(username, password)
dbconn = DBConnection(conf.DB_USER)
cursor = dbconn.get_cursor()
uid = user.get_uid()
user_info = None
if uid in cursor.keys():
user_info = cursor[uid]
if not user_info:
user_info = user.pack_user_info()
user_info['experience'] = experience
user_info['level'] = level
cursor[uid] = user_info
dbconn.write_back(cursor)
reply_info = [('error', False, TYPE.BOOLEAN)]
return reply_info
示例2: register
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_uid [as 别名]
def register(self, cmd_params):
username = cmd_params['username']['value']
password = cmd_params['password']['value']
user = User(username, password)
uid = user.get_uid()
error = False
dbconn = DBConnection(conf.DB_USER)
cursor = dbconn.get_cursor()
if DBConnection.is_user_existed(cursor, user):
print 'User %s has already been register, you can login directly.' % (username)
user.save()
print 'User %s registers successfully.'
return [('error', error, TYPE.BOOLEAN)]