From: Frédéric Péters Date: Sun, 8 Mar 2020 09:56:02 +0000 (+0100) Subject: misc: don't crash error pages in metanav X-Git-Tag: v2021~197 X-Git-Url: https://git.0d.be/?p=panikweb.git;a=commitdiff_plain;h=707412b82f24775a25233d8c8274f6c3a7590af0 misc: don't crash error pages in metanav --- 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'