diff options
| author | Tom Christie | 2013-12-13 21:57:07 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-12-13 21:57:07 +0000 |
| commit | a87c55a93a7ca380bc49425cc6df00f4eba99aa2 (patch) | |
| tree | b0ee7be1bac55e9971214aa7849e5addf7454369 /rest_framework/compat.py | |
| parent | fac6d1a36e39f2fccae77ca49e16c1eb838a51ed (diff) | |
| download | django-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.py | 15 |
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: |
