This commit is contained in:
yumoqing 2023-08-04 14:58:12 +08:00
parent 3f2ae0dd62
commit d8eecb43c3

View File

@ -22,6 +22,7 @@ from aiohttp.web_exceptions import (
HTTPForbidden, HTTPForbidden,
HTTPMethodNotAllowed, HTTPMethodNotAllowed,
HTTPNotFound, HTTPNotFound,
HTTPFound,
) )
from aiohttp.web_fileresponse import FileResponse from aiohttp.web_fileresponse import FileResponse
from aiohttp.web_request import Request from aiohttp.web_request import Request
@ -210,6 +211,10 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
ns = multiDict2Dict(request.query) ns = multiDict2Dict(request.query)
return ns return ns
async def redirect(url):
url = self.entireUrl(request, url)
raise HTTPFound(url)
async def remember_user(userid): async def remember_user(userid):
await auth.remember(request, userid) await auth.remember(request, userid)
@ -226,6 +231,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
return await auth.get_auth(request) return await auth.get_auth(request)
self.y_env.i18n = serveri18n self.y_env.i18n = serveri18n
self.y_env.redirect = redirect
self.y_env.info = self.info self.y_env.info = self.info
self.y_env.error = self.error self.y_env.error = self.error
self.y_env.debug = self.debug self.y_env.debug = self.debug