aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorTom Christie2013-12-13 21:57:07 +0000
committerTom Christie2013-12-13 21:57:07 +0000
commita87c55a93a7ca380bc49425cc6df00f4eba99aa2 (patch)
treeb0ee7be1bac55e9971214aa7849e5addf7454369 /rest_framework/compat.py
parentfac6d1a36e39f2fccae77ca49e16c1eb838a51ed (diff)
downloaddjango-rest-framework-a87c55a93a7ca380bc49425cc6df00f4eba99aa2.tar.bz2
Compat fixes for django-oauth-plus versions 2.0-2.2.1
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index 05bd99e0..88211bec 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -7,6 +7,7 @@ versions of django/python, and compatibility wrappers around optional packages.
from __future__ import unicode_literals
import django
+import inspect
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
@@ -536,9 +537,23 @@ except ImportError:
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: