housekeep: define filters in their own modules

This patch cleans up aurweb.templates and removes direct
module-level initialization of the environment.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-18 03:06:17 -08:00
parent fca175ed84
commit 211ca5e49c
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
16 changed files with 159 additions and 159 deletions

View file

@ -13,7 +13,7 @@ from starlette.requests import HTTPConnection
import aurweb.config
from aurweb import db, l10n, util
from aurweb import db, filters, l10n, util
from aurweb.models import Session, User
from aurweb.models.account_type import ACCOUNT_TYPE_ID
@ -166,7 +166,7 @@ def _auth_required(auth_goal: bool = True):
raise HTTPException(status_code=HTTPStatus.BAD_REQUEST,
detail=_("Bad Referer header."))
url = referer[len(aur) - 1:]
url = "/login?" + util.urlencode({"next": url})
url = "/login?" + filters.urlencode({"next": url})
return RedirectResponse(url, status_code=int(HTTPStatus.SEE_OTHER))
return wrapper