renamed Http404Json to HttpErrorJson
This commit is contained in:
parent
42645a5f27
commit
a551ff32a2
2 changed files with 4 additions and 4 deletions
|
@ -1,12 +1,12 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# 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):
|
class ExceptionMiddleware(object):
|
||||||
|
|
||||||
def process_exception(self, request, exception):
|
def process_exception(self, request, exception):
|
||||||
if isinstance(exception, Http404Json):
|
if isinstance(exception, HttpErrorJson):
|
||||||
return render_to_json_response(exception.response)
|
return render_to_json_response(exception.response)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -7,7 +7,7 @@ except ImportError:
|
||||||
from django.utils import simplejson as json
|
from django.utils import simplejson as json
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
class Http404Json(Http404):
|
class HttpErrorJson(Http404):
|
||||||
def __init__(self, response):
|
def __init__(self, response):
|
||||||
self.response = response
|
self.response = response
|
||||||
|
|
||||||
|
@ -31,5 +31,5 @@ def get_object_or_404_json(klass, *args, **kwargs):
|
||||||
except queryset.model.DoesNotExist:
|
except queryset.model.DoesNotExist:
|
||||||
response = {'status': {'code': 404,
|
response = {'status': {'code': 404,
|
||||||
'text': '%s not found' % queryset.model._meta.object_name}}
|
'text': '%s not found' % queryset.model._meta.object_name}}
|
||||||
raise Http404Json(response)
|
raise HttpErrorJson(response)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue