aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/exceptions.py
diff options
context:
space:
mode:
authorTom Christie2012-08-25 13:43:28 +0100
committerTom Christie2012-08-25 13:43:28 +0100
commit1c28562397f168dc5e71fe1ccd61a8d7253b41e8 (patch)
tree2bd0d0645a5caaae17747f934357faad847e9024 /djangorestframework/exceptions.py
parent26831df88e80feb815aeb3a2b8a7c275a71732e4 (diff)
downloaddjango-rest-framework-1c28562397f168dc5e71fe1ccd61a8d7253b41e8.tar.bz2
Removing 403 immediate response
Diffstat (limited to 'djangorestframework/exceptions.py')
-rw-r--r--djangorestframework/exceptions.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/djangorestframework/exceptions.py b/djangorestframework/exceptions.py
index e70f55df..425b4b8f 100644
--- a/djangorestframework/exceptions.py
+++ b/djangorestframework/exceptions.py
@@ -1,3 +1,22 @@
+from djangorestframework import status
+
+
class ParseError(Exception):
- def __init__(self, detail):
- self.detail = detail
+ status_code = status.HTTP_400_BAD_REQUEST
+ default_detail = 'Malformed request'
+
+ def __init__(self, detail=None):
+ self.detail = detail or self.default_detail
+
+
+class PermissionDenied(Exception):
+ status_code = status.HTTP_403_FORBIDDEN
+ default_detail = 'You do not have permission to access this resource.'
+
+ def __init__(self, detail=None):
+ self.detail = detail or self.default_detail
+
+
+# class Throttled(Exception):
+# def __init__(self, detail):
+# self.detail = detail