aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/permissions.py
diff options
context:
space:
mode:
authorEric Buehl2014-03-06 20:19:21 +0000
committerEric Buehl2014-03-06 20:21:44 +0000
commit34887ed75625a58d00c986b3ea5526877f4724b2 (patch)
tree9550083d51dce99acf2e744e85d891dd803d645c /rest_framework/permissions.py
parent86375f2d9506bcd3c95cb9901d2237672a47da3f (diff)
downloaddjango-rest-framework-34887ed75625a58d00c986b3ea5526877f4724b2.tar.bz2
it's safe to import scope and constants
Diffstat (limited to 'rest_framework/permissions.py')
-rw-r--r--rest_framework/permissions.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py
index 6460056a..f24a5123 100644
--- a/rest_framework/permissions.py
+++ b/rest_framework/permissions.py
@@ -8,7 +8,8 @@ import warnings
SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS']
from django.http import Http404
-from rest_framework.compat import (get_model_name, oauth2_provider)
+from rest_framework.compat import (get_model_name, oauth2_provider_scope,
+ oauth2_constants)
class BasePermission(object):
@@ -218,8 +219,8 @@ class TokenHasReadWriteScope(BasePermission):
if hasattr(token, 'resource'): # OAuth 1
return read_only or not request.auth.resource.is_readonly
elif hasattr(token, 'scope'): # OAuth 2
- required = oauth2_provider.constants.READ if read_only else oauth2_provider.constants.WRITE
- return oauth2_provider.scope.check(required, request.auth.scope)
+ required = oauth2_constants.READ if read_only else oauth2_constants.WRITE
+ return oauth2_provider_scope.check(required, request.auth.scope)
assert False, ('TokenHasReadWriteScope requires either the'
'`OAuthAuthentication` or `OAuth2Authentication` authentication '