From 276110b2a2d1fcd6566cd116e79bf7bda89ac198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Mon, 21 Nov 2022 14:00:52 +0100 Subject: [PATCH] Fix rendering when max_days is not specified --- fabcal/routers/frontend.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fabcal/routers/frontend.py b/fabcal/routers/frontend.py index bd5cf42..cae7597 100644 --- a/fabcal/routers/frontend.py +++ b/fabcal/routers/frontend.py @@ -40,9 +40,19 @@ async def generate_response(request: Request, template_name: str, **additional_c @router.get("/sidebar/embed.html", response_class=HTMLResponse) async def embed_sidebar(request: Request, max_days: int = None): - return await generate_response(request, "sidebar/embed.html", max_days=int(max_days)) + try: + max_days = int(max_days) + except TypeError: + pass + + return await generate_response(request, "sidebar/embed.html", max_days=max_days) @router.get("/sidebar/demo.html", response_class=HTMLResponse) async def sidebar_demo(request: Request, max_days: int = None): - return await generate_response(request, "sidebar/demo.html", max_days=int(max_days)) + try: + max_days = int(max_days) + except TypeError: + pass + + return await generate_response(request, "sidebar/demo.html", max_days=max_days)