Skip to content

Commit

Permalink
fix: error in rare cases where cookies are not populated yet
Browse files Browse the repository at this point in the history
  • Loading branch information
saemideluxe committed Nov 20, 2024
1 parent a4b8251 commit cb38765
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion basxbread/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit cb38765

Please sign in to comment.