From 98926703777cf99fd28d470a1e28fe4691302d6e Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 4 Nov 2010 19:28:35 -0400 Subject: [PATCH] Correctly handling 404s when in JSON views. --- utils/json_functions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/json_functions.py b/utils/json_functions.py index 517603369..ed7bca00c 100644 --- a/utils/json_functions.py +++ b/utils/json_functions.py @@ -5,7 +5,7 @@ from django.utils.encoding import force_unicode from django.utils import simplejson as json from decimal import Decimal from django.core import serializers -from django.http import HttpResponse, HttpResponseForbidden +from django.http import HttpResponse, HttpResponseForbidden, Http404 from django.core.mail import mail_admins from django.db.models.query import QuerySet import sys @@ -96,6 +96,8 @@ def json_view(func): except KeyboardInterrupt: # Allow keyboard interrupts through for debugging. raise + except Http404: + raise Http404 except Exception, e: # Mail the admins with the error exc_info = sys.exc_info()