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 /rest_framework/views.py | |
| 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 'rest_framework/views.py')
| -rw-r--r-- | rest_framework/views.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py index 2c940dac..058a6cd3 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -189,13 +189,13 @@ class APIView(View): """ Instantiates and returns the list of permissions that this view requires. """ - return [permission(self) for permission in self.permission_classes] + return [permission() for permission in self.permission_classes] def get_throttles(self): """ Instantiates and returns the list of thottles that this view uses. """ - return [throttle(self) for throttle in self.throttle_classes] + return [throttle() for throttle in self.throttle_classes] def get_content_negotiator(self): """ @@ -220,7 +220,7 @@ class APIView(View): Return `True` if the request should be permitted. """ for permission in self.get_permissions(): - if not permission.has_permission(request, obj): + if not permission.has_permission(request, self, obj): return False return True @@ -229,7 +229,7 @@ class APIView(View): Check if request should be throttled. """ for throttle in self.get_throttles(): - if not throttle.allow_request(request): + if not throttle.allow_request(request, self): self.throttled(request, throttle.wait()) # Dispatch methods |
