From d8eecb43c31f3425dcb783ac6cdd7239652f51e9 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 4 Aug 2023 14:58:12 +0800 Subject: [PATCH] bugfic --- ahserver/processorResource.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ahserver/processorResource.py b/ahserver/processorResource.py index c8d93fb..70ae470 100755 --- a/ahserver/processorResource.py +++ b/ahserver/processorResource.py @@ -22,6 +22,7 @@ from aiohttp.web_exceptions import ( HTTPForbidden, HTTPMethodNotAllowed, HTTPNotFound, + HTTPFound, ) from aiohttp.web_fileresponse import FileResponse from aiohttp.web_request import Request @@ -210,6 +211,10 @@ class ProcessorResource(AppLogger, StaticResource,Url2File): ns = multiDict2Dict(request.query) return ns + async def redirect(url): + url = self.entireUrl(request, url) + raise HTTPFound(url) + async def remember_user(userid): await auth.remember(request, userid) @@ -226,6 +231,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File): return await auth.get_auth(request) self.y_env.i18n = serveri18n + self.y_env.redirect = redirect self.y_env.info = self.info self.y_env.error = self.error self.y_env.debug = self.debug