From a87c55a93a7ca380bc49425cc6df00f4eba99aa2 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 13 Dec 2013 21:57:07 +0000 Subject: Compat fixes for django-oauth-plus versions 2.0-2.2.1 --- rest_framework/compat.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'rest_framework/compat.py') 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: -- cgit v1.2.3 From fc2dee844ab0ca77928f296f13777bf01d94e6fd Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 16 Dec 2013 08:59:10 +0000 Subject: Don't import compat.py from authtoken.models. Closes #1297 --- rest_framework/compat.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'rest_framework/compat.py') diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 88211bec..b69749fe 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -104,13 +104,6 @@ def get_concrete_model(model_cls): return model_cls -# Django 1.5 add support for custom auth user model -if django.VERSION >= (1, 5): - AUTH_USER_MODEL = settings.AUTH_USER_MODEL -else: - AUTH_USER_MODEL = 'auth.User' - - if django.VERSION >= (1, 5): from django.views.generic import View else: -- cgit v1.2.3