Handle Resolver404 exception in context processors

This commit is contained in:
Raphael Michel
2016-02-17 10:38:43 +01:00
parent ba678de43a
commit 72e66806a6
2 changed files with 11 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
from django.core.urlresolvers import resolve
from django.core.urlresolvers import Resolver404, resolve
from .signals import html_head
@@ -7,7 +7,10 @@ def contextprocessor(request):
"""
Adds data to all template contexts
"""
url = resolve(request.path_info)
try:
url = resolve(request.path_info)
except Resolver404:
return {}
if url.namespace != 'presale':
return {}