本文整理汇总了Python中app.users.models.User.userid方法的典型用法代码示例。如果您正苦于以下问题:Python User.userid方法的具体用法?Python User.userid怎么用?Python User.userid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.users.models.User
的用法示例。
在下文中一共展示了User.userid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from app.users.models import User [as 别名]
# 或者: from app.users.models.User import userid [as 别名]
def create():
args = ['username', 'realname', 'email', 'pw', 'phone']
result = ''
try:
for i in args:
assert i in request.args, 'missing ' + i
assert len(list(graph_db.find("User","username",request.args['username']))) == 0, "user already exists"
assert len(list(graph_db.find("User","email",request.args['email']))) == 0, "email already exists"
u = User(username=request.args['username'],
realname=request.args['realname'],
email=request.args['email'],
password=hash_pw(request.args['pw']),
phone=request.args['phone'])
while True:
u.userid = randint(app.config['UID_START'],app.config['UID_END'])
if len(list(graph_db.find("User","id",u.userid))) == 0: break
u.save()
result = "user %s created" % u.userid
except AssertionError, e:
result = str(e)