jsonresponse: make sure exception message is a serializable string (#11162)

This commit is contained in:
Serghei Mihai 2016-06-01 12:24:14 +02:00
parent e6d39aa0a8
commit d4ba2a2ec8
1 changed files with 2 additions and 1 deletions

View File

@ -11,6 +11,7 @@ from django.http import HttpResponse, Http404
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.translation import force_text
DEFAULT_DEBUG = getattr(settings, 'JSONRESPONSE_DEFAULT_DEBUG', False)
CALLBACK_NAME = getattr(settings, 'JSONRESPONSE_CALLBACK_NAME', 'callback')
@ -304,7 +305,7 @@ class to_json(object):
err_class = err_module + err.__class__.__name__
err_desc = str(err)
err_desc = force_text(err)
return {
"err": 1,