From 3dc8a7f23248e92a7fb68a04e023884d981bf5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Mon, 21 Nov 2022 11:43:56 +0100 Subject: [PATCH] Fix template context --- fabcal/routers/frontend.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/fabcal/routers/frontend.py b/fabcal/routers/frontend.py index 92b6ab4..19d9c6a 100644 --- a/fabcal/routers/frontend.py +++ b/fabcal/routers/frontend.py @@ -1,5 +1,3 @@ -import base64 - from datetime import datetime import babel.dates @@ -28,31 +26,16 @@ async def generate_response(request: Request, template_name: str, **additional_c def localized_abbreviated_weekday(dt: datetime): return babel.dates.format_datetime(dt, format="%b", locale="de_DE") - def base64_encode(s: str): - return base64.b64encode(s.encode()).decode() - context = { "request": request, "grouped_events": grouped_events, - "dir": dir, "localized_abbreviated_month": localized_abbreviated_month, "localized_abbreviated_weekday": localized_abbreviated_weekday, - "base64_encode": base64_encode, } context.update(additional_context) - return templates.TemplateResponse( - template_name, - context={ - "request": request, - "grouped_events": grouped_events, - "dir": dir, - "localized_abbreviated_month": localized_abbreviated_month, - "localized_abbreviated_weekday": localized_abbreviated_weekday, - "base64_encode": base64_encode, - }, - ) + return templates.TemplateResponse(template_name, context=context) @router.get("/sidebar/embed.html", response_class=HTMLResponse)