aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorTom Christie2013-03-12 20:30:14 +0000
committerTom Christie2013-03-12 20:30:14 +0000
commitb6b686d285e376dbf4f2d2f15bd0e3ef0f1c3a37 (patch)
tree1ef5df29e29dfd333240212f955e5b52b69b7a91 /rest_framework/compat.py
parent2f1951910f264852b530c94c3a9946afe10eedd2 (diff)
parent043d748b539a6f5b4cfdf6de650b072541f1c6da (diff)
downloaddjango-rest-framework-b6b686d285e376dbf4f2d2f15bd0e3ef0f1c3a37.tar.bz2
Merge branch 'master' into basic-nested-serialization
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index 07fdddce..7b2ef738 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -426,3 +426,34 @@ try:
import defusedxml.ElementTree as etree
except ImportError:
etree = None
+
+# OAuth is optional
+try:
+ # Note: The `oauth2` package actually provides oauth1.0a support. Urg.
+ import oauth2 as oauth
+except ImportError:
+ oauth = None
+
+# OAuth is optional
+try:
+ import oauth_provider
+ from oauth_provider.store import store as oauth_provider_store
+except ImportError:
+ oauth_provider = None
+ oauth_provider_store = None
+
+# OAuth 2 support is optional
+try:
+ import provider.oauth2 as oauth2_provider
+ from provider.oauth2 import backends as oauth2_provider_backends
+ from provider.oauth2 import models as oauth2_provider_models
+ from provider.oauth2 import forms as oauth2_provider_forms
+ from provider import scope as oauth2_provider_scope
+ from provider import constants as oauth2_constants
+except ImportError:
+ oauth2_provider = None
+ oauth2_provider_backends = None
+ oauth2_provider_models = None
+ oauth2_provider_forms = None
+ oauth2_provider_scope = None
+ oauth2_constants = None