renamed Http404Json to HttpErrorJson

This commit is contained in:
sanj 2010-02-08 21:37:32 +05:30
parent 42645a5f27
commit a551ff32a2
2 changed files with 4 additions and 4 deletions

View file

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from shortcuts import Http404Json, render_to_json_response
from shortcuts import HttpErrorJson, render_to_json_response
class ExceptionMiddleware(object):
def process_exception(self, request, exception):
if isinstance(exception, Http404Json):
if isinstance(exception, HttpErrorJson):
return render_to_json_response(exception.response)
else:
return None

View file

@ -7,7 +7,7 @@ except ImportError:
from django.utils import simplejson as json
from django.conf import settings
class Http404Json(Http404):
class HttpErrorJson(Http404):
def __init__(self, response):
self.response = response
@ -31,5 +31,5 @@ def get_object_or_404_json(klass, *args, **kwargs):
except queryset.model.DoesNotExist:
response = {'status': {'code': 404,
'text': '%s not found' % queryset.model._meta.object_name}}
raise Http404Json(response)
raise HttpErrorJson(response)