aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorTom Christie2014-12-03 23:11:04 +0000
committerTom Christie2014-12-03 23:11:04 +0000
commitaf23ec36bbf4ccb8f4179e790b49b11677ccf6ee (patch)
tree7ea80a203cc8718150cd55e4403f3f4771160281 /rest_framework/compat.py
parent3a5b3772fefc3c2f2c0899947cbc07bfe6e6b5d2 (diff)
parent0cc990792c63caa8fa8fea62cea53b0d28157b55 (diff)
downloaddjango-rest-framework-af23ec36bbf4ccb8f4179e790b49b11677ccf6ee.tar.bz2
Merge branch 'jpadilla-oauth_as_package' into version-3.1
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index 5bd85e74..da2496d8 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -251,56 +251,6 @@ except ImportError:
etree = None
-# OAuth2 is optional
-try:
- # Note: The `oauth2` package actually provides oauth1.0a support. Urg.
- import oauth2 as oauth
-except ImportError:
- oauth = None
-
-
-# OAuthProvider is optional
-try:
- import oauth_provider
- from oauth_provider.store import store as oauth_provider_store
-
- # check_nonce's calling signature in django-oauth-plus changes sometime
- # between versions 2.0 and 2.2.1
- def check_nonce(request, oauth_request, oauth_nonce, oauth_timestamp):
- check_nonce_args = inspect.getargspec(oauth_provider_store.check_nonce).args
- if 'timestamp' in check_nonce_args:
- return oauth_provider_store.check_nonce(
- request, oauth_request, oauth_nonce, oauth_timestamp
- )
- return oauth_provider_store.check_nonce(
- request, oauth_request, oauth_nonce
- )
-
-except (ImportError, ImproperlyConfigured):
- oauth_provider = None
- oauth_provider_store = None
- check_nonce = None
-
-
-# OAuth 2 support is optional
-try:
- import provider as oauth2_provider
- from provider import scope as oauth2_provider_scope
- from provider import constants as oauth2_constants
- if oauth2_provider.__version__ in ('0.2.3', '0.2.4'):
- # 0.2.3 and 0.2.4 are supported version that do not support
- # timezone aware datetimes
- import datetime
- provider_now = datetime.datetime.now
- else:
- # Any other supported version does use timezone aware datetimes
- from django.utils.timezone import now as provider_now
-except ImportError:
- oauth2_provider = None
- oauth2_provider_scope = None
- oauth2_constants = None
- provider_now = None
-
# `seperators` argument to `json.dumps()` differs between 2.x and 3.x
# See: http://bugs.python.org/issue22767
if six.PY3: