From 115608cf9846420cb58d0b4355e6367b6eaf1a65 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 6 Nov 2020 11:15:28 +0800 Subject: [PATCH] bugfix --- ahserver/auth_api.py | 11 ----------- ahserver/processorResource.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ahserver/auth_api.py b/ahserver/auth_api.py index bb0a59a..cafece1 100644 --- a/ahserver/auth_api.py +++ b/ahserver/auth_api.py @@ -36,19 +36,8 @@ class AuthAPI: # setup aiohttp_auth.auth middleware in aiohttp fashion auth.setup(app, policy) app.middlewares.append(self.checkAuth) - # app.router.add_route('POST','/login',self.login) app.router.add_route('GET', '/logout', self.logout) - async def login(self,request): - params = await request.post() - user_id = params.get('user',None) - password = params.get('password',None) - from_path = params.get('from_path',None) - if await self.checkUserPassword(user_id,password): - await auth.remember(request, user) - return web.HpptFound(from_path) - raise web.HTTPUnauthorized() - async def checkLogin(self,request): """ authorization header has the format: diff --git a/ahserver/processorResource.py b/ahserver/processorResource.py index b22a1c6..e25f29d 100644 --- a/ahserver/processorResource.py +++ b/ahserver/processorResource.py @@ -20,6 +20,7 @@ from aiohttp.web_routedef import AbstractRouteDef from appPublic.jsonConfig import getConfig from appPublic.MiniI18N import getI18N from appPublic.dictObject import DictObject, multiDict2Dict +from appPublic.timecost import TimeCost from .baseProcessor import getProcessor from .xlsxdsProcessor import XLSXDataSourceProcessor @@ -117,6 +118,15 @@ class ProcessorResource(StaticResource,Url2File): return ns async def _handle(self,request:Request) -> StreamResponse: + t = TimeCost() + name = str(request.url) + t.begin(name) + x = self._handle1(request) + t.end(name) + print(name,':', ':'.join(t.getTimeCost(name))) + return x + + async def _handle1(self,request:Request) -> StreamResponse: clientkeys = { "iPhone":"iphone", "iPad":"ipad",