diff options
| author | Sébastien Piquemal | 2012-02-07 13:15:30 +0200 |
|---|---|---|
| committer | Sébastien Piquemal | 2012-02-07 13:15:30 +0200 |
| commit | ca96b4523b4c09489e4bfe726a894a5c6ada78aa (patch) | |
| tree | 7f9613e56b6ceb7f1c2760e2def3ec9114983430 /djangorestframework/permissions.py | |
| parent | a0dc0b10e53cd565b8264407769b6fd468a46230 (diff) | |
| download | django-rest-framework-ca96b4523b4c09489e4bfe726a894a5c6ada78aa.tar.bz2 | |
cleaned a bit Response/ResponseMixin code, added some documentation + renamed ErrorResponse to ImmediateResponse
Diffstat (limited to 'djangorestframework/permissions.py')
| -rw-r--r-- | djangorestframework/permissions.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/djangorestframework/permissions.py b/djangorestframework/permissions.py index bce03cab..4ddc35cb 100644 --- a/djangorestframework/permissions.py +++ b/djangorestframework/permissions.py @@ -6,7 +6,7 @@ class to your view by setting your View's :attr:`permissions` class attribute. from django.core.cache import cache from djangorestframework import status -from djangorestframework.response import ErrorResponse +from djangorestframework.response import ImmediateResponse import time __all__ = ( @@ -21,12 +21,12 @@ __all__ = ( ) -_403_FORBIDDEN_RESPONSE = ErrorResponse( +_403_FORBIDDEN_RESPONSE = ImmediateResponse( content={'detail': 'You do not have permission to access this resource. ' + 'You may need to login or otherwise authenticate the request.'}, status=status.HTTP_403_FORBIDDEN) -_503_SERVICE_UNAVAILABLE = ErrorResponse( +_503_SERVICE_UNAVAILABLE = ImmediateResponse( content={'detail': 'request was throttled'}, status=status.HTTP_503_SERVICE_UNAVAILABLE) @@ -43,7 +43,7 @@ class BasePermission(object): def check_permission(self, auth): """ - Should simply return, or raise an :exc:`response.ErrorResponse`. + Should simply return, or raise an :exc:`response.ImmediateResponse`. """ pass @@ -116,7 +116,7 @@ class BaseThrottle(BasePermission): def check_permission(self, auth): """ Check the throttling. - Return `None` or raise an :exc:`.ErrorResponse`. + Return `None` or raise an :exc:`.ImmediateResponse`. """ num, period = getattr(self.view, self.attr_name, self.default).split('/') self.num_requests = int(num) |
