diff --git a/basxbread/middleware.py b/basxbread/middleware.py index 2df3afbf..6068da71 100644 --- a/basxbread/middleware.py +++ b/basxbread/middleware.py @@ -46,7 +46,9 @@ def __call__(self, request): timezone.activate(zoneinfo.ZoneInfo(tz)) else: timezone.deactivate() - if not tz and "basxbread-timezone" in request.session["basxbread-cookies"]: + if not tz and "basxbread-timezone" in request.session.get( + "basxbread-cookies", {} + ): timezone.activate( zoneinfo.ZoneInfo( request.session["basxbread-cookies"]["basxbread-timezone"]