From 39c9746abf6bf7e519879454b4153fb03948dd34 Mon Sep 17 00:00:00 2001 From: chen <1415441706@qq.com> Date: Thu, 23 Dec 2021 15:30:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E8=A2=AB=E5=A2=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pythonweb/www/app.py | 2 +- pythonweb/www/handlers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pythonweb/www/app.py b/pythonweb/www/app.py index 3a0b993..aaff22f 100644 --- a/pythonweb/www/app.py +++ b/pythonweb/www/app.py @@ -85,7 +85,7 @@ def data_factory(app, handler): @asyncio.coroutine def response_factory(app, handler): @asyncio.coroutine - def response(request): + def response(request, t=None): logging.info('Response handler...') r = yield from handler(request) if isinstance(r, web.StreamResponse): diff --git a/pythonweb/www/handlers.py b/pythonweb/www/handlers.py index 89f124c..dd669c6 100644 --- a/pythonweb/www/handlers.py +++ b/pythonweb/www/handlers.py @@ -11,7 +11,7 @@ import markdown2 from aiohttp import web from coroweb import get, post -from apis import Page, APIValueError, APIResourceNotFoundError +from apis import Page, APIValueError, APIResourceNotFoundError, APIPermissionError, APIError from models import User, Comment, Blog, next_id from config import configs @@ -249,7 +249,7 @@ def api_register_user(*, email, name, passwd): 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='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest()) + user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='https://dn-qiniu-avatar.qbox.me/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest()) yield from user.save() # make session cookie: r = web.Response()