aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/exceptions.py
diff options
context:
space:
mode:
authorMichael Elovskikh2013-01-28 16:26:16 +0600
committerMichael Elovskikh2013-01-28 16:26:16 +0600
commit499d6424aee5b71b8e6b2500bf14fa85321bfc26 (patch)
tree34f575fb078377208ded5251aea050668355d82a /rest_framework/exceptions.py
parent180c94dc44a9cc5b882364a58b0b12a8ab430c22 (diff)
parent3bcd38b7d0ddaa2c051ad230cb0d749f9737fd82 (diff)
downloaddjango-rest-framework-499d6424aee5b71b8e6b2500bf14fa85321bfc26.tar.bz2
Merge branch 'upstream_master' into docs_patch_method
Conflicts: docs/api-guide/authentication.md
Diffstat (limited to 'rest_framework/exceptions.py')
-rw-r--r--rest_framework/exceptions.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py
index 89479deb..d635351c 100644
--- a/rest_framework/exceptions.py
+++ b/rest_framework/exceptions.py
@@ -23,6 +23,22 @@ class ParseError(APIException):
self.detail = detail or self.default_detail
+class AuthenticationFailed(APIException):
+ status_code = status.HTTP_401_UNAUTHORIZED
+ default_detail = 'Incorrect authentication credentials.'
+
+ def __init__(self, detail=None):
+ self.detail = detail or self.default_detail
+
+
+class NotAuthenticated(APIException):
+ status_code = status.HTTP_401_UNAUTHORIZED
+ default_detail = 'Authentication credentials were not provided.'
+
+ def __init__(self, detail=None):
+ self.detail = detail or self.default_detail
+
+
class PermissionDenied(APIException):
status_code = status.HTTP_403_FORBIDDEN
default_detail = 'You do not have permission to perform this action.'