diff options
| author | Tom Christie | 2013-12-23 09:48:59 +0000 | 
|---|---|---|
| committer | Tom Christie | 2013-12-23 09:48:59 +0000 | 
| commit | 52686420f4bf866064ee88a15903665f14289394 (patch) | |
| tree | 41ea7b0d4863092f996f63de14e678a1c74a7a3a /rest_framework/compat.py | |
| parent | 9c41c007afc71c899306bcb02e40bdfc36b09146 (diff) | |
| parent | 83b31e7ea298a8948e9a76c9b971845ea0052b3c (diff) | |
| download | django-rest-framework-52686420f4bf866064ee88a15903665f14289394.tar.bz2 | |
Merge branch 'bennbollay-patch-1' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/routers.md
	rest_framework/compat.py
	tox.ini
Diffstat (limited to 'rest_framework/compat.py')
| -rw-r--r-- | rest_framework/compat.py | 22 | 
1 files changed, 15 insertions, 7 deletions
| diff --git a/rest_framework/compat.py b/rest_framework/compat.py index b4d37ab8..45045c0f 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -6,6 +6,7 @@ versions of django/python, and compatibility wrappers around optional packages.  # flake8: noqa  from __future__ import unicode_literals  import django +import inspect  from django.core.exceptions import ImproperlyConfigured  from django.conf import settings @@ -99,13 +100,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' - -  # View._allowed_methods only present from 1.5 onwards  if django.VERSION >= (1, 5):      from django.views.generic import View @@ -201,9 +195,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 | 
