From 707412b82f24775a25233d8c8274f6c3a7590af0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 8 Mar 2020 10:56:02 +0100 Subject: [PATCH] misc: don't crash error pages in metanav --- panikweb/paniktags/templatetags/paniktags.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/panikweb/paniktags/templatetags/paniktags.py b/panikweb/paniktags/templatetags/paniktags.py index b6d468d..a8f9e7d 100644 --- a/panikweb/paniktags/templatetags/paniktags.py +++ b/panikweb/paniktags/templatetags/paniktags.py @@ -131,7 +131,11 @@ def player(context): @register.inclusion_tag('includes/metaNav.html', takes_context=True) def metanav(context, active=None): - request_path = context['request'].path + try: + request_path = context['request'].path + except KeyError: + # a context without 'requests' may happen when rendering error pages + request_path = 'xxx' section = 'About' if request_path == '/': section = 'Home' -- 2.39.2