Fix failing requests without User-Agent

This commit is contained in:
Raphael Michel
2021-05-14 19:37:42 +02:00
parent 44b1aaa440
commit 4bcb810140

View File

@@ -155,7 +155,7 @@ def _default_context(request):
if not gs.settings.update_check_ack and 'runserver' not in sys.argv:
ctx['warning_update_check_active'] = True
ctx['ie_deprecation_warning'] = 'MSIE' in request.headers['User-Agent'] or 'Trident/' in request.headers['User-Agent']
ctx['ie_deprecation_warning'] = 'MSIE' in request.headers.get('User-Agent', '') or 'Trident/' in request.headers.get('User-Agent', '')
if request.user.is_authenticated:
ctx['staff_session'] = request.user.has_active_staff_session(request.session.session_key)