]> git.0d.be Git - panikweb.git/commitdiff
misc: don't crash error pages in metanav
authorFrédéric Péters <fpeters@0d.be>
Sun, 8 Mar 2020 09:56:02 +0000 (10:56 +0100)
committerFrédéric Péters <fpeters@0d.be>
Sun, 8 Mar 2020 09:56:02 +0000 (10:56 +0100)
panikweb/paniktags/templatetags/paniktags.py

index b6d468dd9398bbf054d7de774ee50d79e40032c9..a8f9e7d540a018faa24de9526df7cf96544bef45 100644 (file)
@@ -131,7 +131,11 @@ def player(context):
 
 @register.inclusion_tag('includes/metaNav.html', takes_context=True)
 def metanav(context, active=None):
 
 @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'
     section = 'About'
     if request_path == '/':
         section = 'Home'