aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorTom Christie2013-03-12 12:27:05 -0700
committerTom Christie2013-03-12 12:27:05 -0700
commit40e3fc0eee96b85140ea020e321cf403956fbb80 (patch)
tree7735202eec798c41586460e5ea504f8f39504434 /rest_framework/compat.py
parent20880232930dd6f3a1de9dda1546c84b9279a258 (diff)
parentf513db714db76849448bf2e2412428ee7121ebf6 (diff)
downloaddjango-rest-framework-40e3fc0eee96b85140ea020e321cf403956fbb80.tar.bz2
Merge pull request #709 from tomchristie/oauth
OAuth support
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