diff options
| author | Tom Christie | 2012-10-10 10:02:37 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-10-10 10:02:37 +0100 |
| commit | ccd2b0117d9c26199b1862a302b1eb06dd2f07b2 (patch) | |
| tree | 05e47209445303f2cda704d4ac50791551ddae5b /docs/api-guide | |
| parent | 900c4b625b62a6c1f4a16bfe8d6b5d77480427ff (diff) | |
| download | django-rest-framework-ccd2b0117d9c26199b1862a302b1eb06dd2f07b2.tar.bz2 | |
Permissions and throttles no longer have a view attribute on self. Explicitly passed to .has_permissions(request, view, obj=None) / .allow_request(request, view)
Diffstat (limited to 'docs/api-guide')
| -rw-r--r-- | docs/api-guide/permissions.md | 2 | ||||
| -rw-r--r-- | docs/api-guide/throttling.md | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index 9a3c39ab..b6912d88 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -88,7 +88,7 @@ The `DjangoModelPermissions` class also supports object-level permissions. Thir ## Custom permissions -To implement a custom permission, override `BasePermission` and implement the `.has_permission(self, request, obj=None)` method. +To implement a custom permission, override `BasePermission` and implement the `.has_permission(self, request, view, obj=None)` method. The method should return `True` if the request should be granted access, and `False` otherwise. diff --git a/docs/api-guide/throttling.md b/docs/api-guide/throttling.md index 7861e9ba..0e228905 100644 --- a/docs/api-guide/throttling.md +++ b/docs/api-guide/throttling.md @@ -144,8 +144,8 @@ User requests to either `ContactListView` or `ContactDetailView` would be restri ## Custom throttles -To create a custom throttle, override `BaseThrottle` and implement `.allow_request(request)`. The method should return `True` if the request should be allowed, and `False` otherwise. +To create a custom throttle, override `BaseThrottle` and implement `.allow_request(request, view)`. The method should return `True` if the request should be allowed, and `False` otherwise. -Optionally you may also override the `.wait()` method. If implemented, `.wait()` should return a recomended number of seconds to wait before attempting the next request, or `None`. The `.wait()` method will only be called if `.check_throttle()` has previously returned `False`. +Optionally you may also override the `.wait()` method. If implemented, `.wait()` should return a recomended number of seconds to wait before attempting the next request, or `None`. The `.wait()` method will only be called if `.allow_request()` has previously returned `False`. [permissions]: permissions.md |
