fix APIView.permission_denied : NotAuthenticated exception can use user defined message

This commit is contained in:
Christophe Duvernois 2017-06-08 18:46:25 +02:00
parent 836e49b535
commit ed63f6eee3

View File

@ -167,7 +167,7 @@ class APIView(View):
If request is not permitted, determine what kind of exception to raise.
"""
if request.authenticators and not request.successful_authenticator:
raise exceptions.NotAuthenticated()
raise exceptions.NotAuthenticated(detail=message)
raise exceptions.PermissionDenied(detail=message)
def throttled(self, request, wait):