本文整理汇总了Python中models.next_id函数的典型用法代码示例。如果您正苦于以下问题:Python next_id函数的具体用法?Python next_id怎么用?Python next_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了next_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: mymanage_create_blog
def mymanage_create_blog():
return {
'__template__': 'mymanage_blog_edit.html',
'id': '',
'new_id': next_id(),
'action': '/myapi/blogs'
}
开发者ID:daihaovigg,项目名称:web,代码行数:7,代码来源:handlers.py
示例2: api_register_user
def api_register_user(*, email, name, passwd):
#判断name是否为空:
if not name or not name.strip():
raise APIValueError('name')
#判断email是否为空及是否满足email格式:
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
#判断password首付为空及是否满足password格式:
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
#数据中查询对应的email信息:
users = yield from User.findAll('email=?', [email])
#判断查询结果是否存在,若存在则返回异常提示邮件已存在:
if len(users) > 0:
raise APIError('register:failed', 'email', 'Email is already in use.')
#生成唯一ID:
uid = next_id()
#重构唯一ID和password成新的字符串:
sha1_passwd = '%s:%s' % (uid, passwd)
#构建用户对象信息:
#hashlib.sha1().hexdigest():取得SHA1哈希摘要算法的摘要值。
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest())
#将用户信息存储到数据库:
yield from user.save()
# make session cookie:
#构造session cookie信息:
r = web.Response()
#aiohttp.web.StreamResponse().set_cookie():设置cookie的方法。
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True) #max_age:定义cookie的有效期(秒);
user.passwd = '******'
r.content_type = 'application/json'
#以json格式序列化响应信息; ensure_ascii默认为True,非ASCII字符也进行转义。如果为False,这些字符将保持原样。
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:zhangshengyue,项目名称:text,代码行数:34,代码来源:handlersdetail.py
示例3: api_register_user
def api_register_user(*, email, name, passwd):
if not name or not name.strip():
raise APIValueError('name')
if not email or not RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not RE_SHA1.match(passwd):
raise APIValueError('password')
# 要求邮箱是唯一的
users = yield from User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register:faild', 'email', 'Email is already in use')
# 生成当前注册用户唯一的uid
uid = next_id()
sha1_passwd = '%s:%s' %(uid, passwd)
# 创建一个用户并保存
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(),
image='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest())
yield from user.save()
logging.info('save user: %s ok' % name)
# 构建返回信息
r = web.Response()
# 添加cookie
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
user.passwd = '******'
# 设置返回的数据格式是json
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:Parlefan,项目名称:Python3-BlogWeb,代码行数:32,代码来源:handlers.py
示例4: api_register_user
async def api_register_user(*, email, name, passwd):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('password')
users = await User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register failed', 'email', 'Email is already in use')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
passwd = hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest()
image = 'http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(
email.encode('utf-8')).hexdigest()
user = User(uid=uid,
name=name.strip(),
email=email,
passwd=passwd,
image=image)
await user.save()
# make session in cookie
r = web.Response()
r.set_cookie(COOKIE_NAME,
user2cookie(user, 86400),
max_age=86400,
httponly=True)
user.passwd = '********'
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:chensource,项目名称:BeginningPython,代码行数:33,代码来源:handlers.py
示例5: api_register_user
async def api_register_user(*, email, name, passwd):
'''
Store user register info
'''
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
users = await User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register:failed', 'email', 'Email is already in use.')
users = await User.findAll('name=?', [name])
if len(users) > 0:
raise APIError('register:failed', 'name', 'Username is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
# hashlib.sha1().hexdigest():取得SHA1哈希摘要算法的摘要值。
# 用户口令是客户端传递的经过SHA1计算后的40位Hash字符串,所以服务器端并不知道用户的原始口令
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest())
await user.save()
# make session cookie
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
user.passwd = '******'
r.content_type = 'application/json'
# 以json格式序列化响应信息; ensure_ascii默认为True,非ASCII字符也进行转义。如果为False,这些字符将保持原样。
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:jiejackyzhang,项目名称:awsome-python3-blog-webapp,代码行数:30,代码来源:handlers.py
示例6: api_register_user
def api_register_user(*, email, name, passwd,img_uuid):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
users = yield from User.findAll('email=?', [email])
if len(users) > 0:
raise APIValueError('email', 'Email is already in use.')
users = yield from User.findAll('name=?', [name])
if len(users) > 0:
raise APIValueError('name', 'name is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
img_path="/static/HeadImg/"
img_path=img_path+img_uuid
img_path=img_path+".jpg"
path=os.path.abspath('.')
path=os.path.join(path,"static")
path=os.path.join(path,"HeadImg")
path=os.path.join(path,"%s.jpg" % img_uuid)
if not os.path.exists(path):
img_path="/static/img/default.jpg"
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image=img_path)
yield from user.save()
# make session cookie:
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
user.passwd = '******'
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:daihaovigg,项目名称:web,代码行数:34,代码来源:handlers.py
示例7: api_register_user
def api_register_user(*, email, name, password):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not password or not _RE_SHA1.match(password):
raise APIValueError('password')
users = yield from User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register failed!', 'email', 'Email is already in use')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, password)
admin = False
if email == '[email protected]':
admin = True
user = User(id=uid, name=name.strip(), password=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(),
image='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest(),
admin=admin)
yield from user.save()
logging.info('save user ok.')
# 构建返回信息
r = web.Response()
r.set_cookie(_COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
# 把要返回的实例的密码改成‘******’,这样数据库中的密码是正确的,并保证真实的密码不会因返回而泄露
user.password = '******'
r.content_type = 'application/json;charset:utf-8'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:crazyAxe,项目名称:aWebapp,代码行数:29,代码来源:handlers.py
示例8: api_register_user
def api_register_user(*, email, name, password):
if not name or not name.strip():
raise APIValueError("name")
if not email or not _RE_EMAIL.match(email):
raise APIValueError("email")
if not password or not _RE_SHA1.match(password):
raise APIValueError("password")
users = yield from User.findAll("email=?", [email])
if len(users) > 0:
raise APIError("register:failed", "email", "Email is already in use.")
uid = next_id()
sha1_password = "%s:%s" % (uid, password)
user = User(
id=uid,
name=name.strip(),
email=email,
password=hashlib.sha1(sha1_password.encode("utf-8")).hexdigest(),
image="/static/img/user.png",
)
yield from user.save()
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
user.password = "******"
r.content_type = "application/json"
r.body = json.dumps(user, ensure_ascii=False).encode("utf-8")
return r
开发者ID:naphystart,项目名称:PersonalBlog,代码行数:26,代码来源:handlers.py
示例9: api_register_fbuser
def api_register_fbuser(*, email, name, passwd, number, birthday):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
if not number.isdigit():
raise APIValueError('number should > 0')
#if not birthday:
# raise APIValueError('birthday')
print("number:" + number)
#validation user
fbusers = yield from FBUser.findAll('email=?', [email])
if len(fbusers) > 0:
raise APIError('register:failed', 'email', 'Email is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
fbuser = FBUser(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), number=number, birthday=birthday.strip())
yield from fbuser.save()
# make session cookie:
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(fbuser, 86400), max_age=86400, httponly=True)
fbuser.passwd = '******'
r.content_type = 'application/json'
r.body = json.dumps(fbuser, cls=CJsonEncoder, ensure_ascii=False).encode('utf-8')
return r
开发者ID:zero530,项目名称:fb4u,代码行数:30,代码来源:handlers.py
示例10: api_register_user
def api_register_user(*, email, name, passwd):
#检查注册信息合法性
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
#根据email查找用户是否已存在
users = yield from User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register:failed', 'email', '该邮箱已被注册')
#若注册信息合法,生成唯一id
uid = next_id()
#对密码进行加密后,将用户信息存入数据库
sha1_passwd = '%s:%s' % (uid, passwd)
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest())
yield from user.save()
r = web.Response()
#设置cookie
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
user.passed = '******'
r.content_type = 'application/json'
#返回json数据,ensure_ascii=False,即非ASCII字符将保持原样,不进行转义
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:Tdpiamix,项目名称:webapp-blog,代码行数:26,代码来源:handlers.py
示例11: API_UserRegister
async def API_UserRegister(*, email, name, passwd):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
users = await User.findAll('email = ?', [email])
if len(users) > 0:
raise APIError('register:failed', 'email', 'Email is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
user = User(
id = uid,
name = name.strip(),
email = email,
passwd = hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(),
image = r'E:\Study\Git\Python\myPython3WebApp\www\static\img\user.png'
)
await user.save()
#make session cookie:
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
user.passwd = '******'
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:LightsJiao,项目名称:MyGitHub,代码行数:31,代码来源:handlers.py
示例12: api_register_user
def api_register_user():
uid = next_id()
sha1_passwd = '%s:%s' % (uid, request.json['passwd'])
user = User(id=uid, name=request.json['name'].strip(), email=request.json['email'], passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest())
db.session.add(user)
db.session.commit()
r=jsonify({'db':'1'})
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
r.content_type = 'application/json;charset=utf-8'
return r
开发者ID:sixiaobai,项目名称:awesome_webapp_flask,代码行数:10,代码来源:views.py
示例13: api_create_comments
def api_create_comments(id, request, *, content):
user = request.__user__
if user is None:
raise APIPermissionError('content')
if not content or not content.strip():
raise APIValueError('content')
blog = yield from Blog.find(id)
if blog is None:
raise APIResourceNotFoundError('Blog')
comment = Comment(id=next_id(), user_id=user.id, user_name=user.name, image=user.image, content=content.strip())
yield from comment.save()
return comment
开发者ID:crazyAxe,项目名称:aWebapp,代码行数:12,代码来源:handlers.py
示例14: blog_id
def blog_id(id):
if request.method == 'POST':
comment_content = request.form['comment_content']
comment_name = request.form['comment_name']
comment = Comment(id=next_id(), blog_id=id, user_id='guest', user_name=comment_name,
user_image='',
content=comment_content, created_at=time.time())
comment.save()
image = common.create_avatar_by_name(comment_name)
user = User(id=next_id(), email='', passwd='', admin=0, name=comment_name,
image=image,
created_at=time.time())
mylog.info(image)
# TODO 先使用name来进行判定是否唯一,后期希望能够使用email来判断是否唯一
_user = User.find_all('name= ?', [comment_name])
if len(_user) == 0:
user.save()
flash('comment and new user had been saved successfully!')
blog = Blog.find(id)
md_text = highlight.parse2markdown(blog.content)
blog.html_content = md_text
comments = Comment.find_all('blog_id= ?', [id])
return render_template('blogdetail.html', blog=blog, comments=comments)
开发者ID:fantianwen,项目名称:web_blog,代码行数:24,代码来源:app.py
示例15: api_register_user
def api_register_user(*, email, name, passwd):
logging.info('api_register_user...')
#判断name是否存在,且是否'\n','\r','\t',' '这种特殊字符
if not name or not name.strip():
raise APIValueError('name')
#判断email是否存在,且符合格式
if not email or not _RE_EMAIL.match(email):
logging.info('email api_register_user...')
raise APIValueError('email')
#判断passwd是否存在,且是否符合格式
if not passwd or not _RE_SHA1.match(passwd):
logging.info('passwd api_register_user...')
raise APIValueError('passwd')
#查一下库里是否有相同的email地址,如果有的话提示用户email已经被注册过
users = yield from User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register:failed', 'email', 'Email is already in use')
#生成一个当前要注册的用户的唯一uid
uid = next_id()
#构建shal_passwd
sha1_passwd = '%s:%s' % (uid, passwd)
admin = False
if email == '[email protected]':
admin = True
#创建一个用户,密码通过sha1加密保存
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode( 'utf-8')).hexdigest(), admin=admin)
#保存这个用户到数据库用户表
yield from user.save()
logging.info('save user OK')
#构建返回信息
r = web.Response()
#添加cookie
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
#只把要返回的实例的密码改成‘******’,库里的密码依然是真实的,以保证真实的密码不会因返回而暴露
user.passwd = '******'
#返回的是json数据,所以设置content-type为json的
r.content_type = 'application/json'
#把对象转换成json格式返回
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:idyllchow,项目名称:bit-record,代码行数:45,代码来源:handlers.py
示例16: api_register_user
async def api_register_user(*, email, name, passwd):
if not email and not name and not passwd:
raise Exception('missing arguments for register')
if not _RE_EMAIL.match(email):
raise Exception('illegal email')
if not _RE_SHA1.match(passwd):
raise Exception('illegal passwd')
users = await User.findAll('email=?', [email])
if len(users) > 0:
raise Exception('email existed')
uid = next_id()
sha1_passwd = '%s:%s' % (uid , passwd)
user = User(id=uid, email=email, name=name.strip(), passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image="blank:about", created_at=time.time())
await user.save()
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, 60*60*24), max_age=60*60*24, httponly=True)
user.passwd = '******'
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:theJian,项目名称:plogger,代码行数:20,代码来源:handlers.py
示例17: api_register_user
def api_register_user(*, email, name, passwd):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
users = yield from User.findAll('email=?', email)
if len(users) > 0:
raise APIError('register failed', 'email', 'Email is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode()).hexdigest(),
# image='http://www.gravatar.com/acatar/%s?d=mm&s=120' % hashlib.md5(email.encode()).hexdigest())
image='/static/img/user.png', admin=True)
yield from user.save()
r = web.Response()
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode()
return r
开发者ID:githubao,项目名称:xiao-first-webapp,代码行数:20,代码来源:handlers.py
示例18: api_register
def api_register(*, email, name, passwd):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
users = yield from User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register:failed', 'email', 'Email is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), groups='001449655503983177fbe60d9744c9d99c77ed1a7612acd000')
yield from user.save()
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, MAX_AGE), max_age=MAX_AGE, httponly=True)
user.passwd = '******'
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return(r)
开发者ID:Madongming,项目名称:myframework,代码行数:20,代码来源:userregAlogin.py
示例19: api_register_user
def api_register_user(*, email, name, passwd):
"""
save in table: USER
登录之后,可以增加邮箱激活模块,邮件激活。
"""
logging.info("......................")
if not name or not name.strip():
raise APIValueError("name")
if not email or not _RE_EMAIL.match(email):
raise APIValueError("email")
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError("passwd")
users = yield from User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register:failed', 'email', 'Email is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
# 创建用户对象, 其中密码并不是用户输入的密码,而是经过复杂处理后的保密字符串
# sha1(secure hash algorithm),是一种不可逆的安全算法.
# hexdigest()函数将hash对象转换成16进制表示的字符串
# md5是另一种安全算法
# Gravatar(Globally Recognized Avatar)是一项用于提供在全球范围内使用的头像服务。
# 便可以在其他任何支持Gravatar的博客、论坛等地方使用它。此处image就是一个根据用户email生成的头像
user = User(
id=uid,
name=name.strip(),
email=email,
passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(),
# image="http://www.gravatar.com/avatar/%s?d=mm&s=120" % hashlib.md5(email.encode('utf-8')).hexdigest(),
image="about:blank"
)
yield from user.save()
# 此处的cookie:网站为了辨别用户身份而储存在用户本地终端的数据
# http协议是一种无状态的协议,即服务器并不知道用户上一次做了什么.服务器通过cookie跟踪用户状态。
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True) # 86400s=24h
# 修改密码的外部显示为* ?
user.passwd = '*****'
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:lovelywxd,项目名称:blogs-web-python,代码行数:41,代码来源:handlers.py
示例20: api_register_user
async def api_register_user(*, email, name, passwd):
if not name or not name.strip():
raise APIValueError('name')
if not email or not _RE_EMAIL.match(email):
raise APIValueError('email')
if not passwd or not _RE_SHA1.match(passwd):
raise APIValueError('passwd')
users = await User.findAll('email=?', [email])
if len(users) > 0:
raise APIError('register:failed', 'email', 'Email is already in use.')
uid = next_id()
sha1_passwd = '%s:%s' % (uid, passwd)
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='https://www.funnypica.com/wp-content/uploads/2015/05/TOP-50-Beautiful-Girls-Girl-25-of-50.jpg')
await user.save()
# make session cookie:
r = web.Response()
r.set_cookie(COOKIE_NAME, user2cookie(user, 86400), max_age=86400, httponly=True)
user.passwd = '******'
r.content_type = 'application/json'
r.body = json.dumps(user, ensure_ascii=False).encode('utf-8')
return r
开发者ID:GitDongLei,项目名称:Awesome_Equipment_Management_System,代码行数:21,代码来源:handlers.py
注:本文中的models.next_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论