Commit 8845c0be by Pierre Dulac

Fix import errors

parent 30e3775b
......@@ -431,5 +431,12 @@ except ImportError:
# OAuth 2 support is optional
try:
import provider.oauth2 as oauth2_provider
# Hack to fix submodule import issues
submodules = ['backends', 'forms','managers','models','urls','views']
for s in submodules:
mod = __import__('provider.oauth2.%s.*' % s)
setattr(oauth2_provider, s, mod)
except ImportError:
oauth2_provider = None
......@@ -106,7 +106,7 @@ try:
'provider',
'provider.oauth2',
)
except ImportError, inst:
except ImportError:
import logging
logging.warning("django-oauth2-provider is not install, some tests will be skipped")
......
......@@ -46,10 +46,14 @@ urlpatterns = patterns('',
(r'^basic/$', MockView.as_view(authentication_classes=[BasicAuthentication])),
(r'^token/$', MockView.as_view(authentication_classes=[TokenAuthentication])),
(r'^auth-token/$', 'rest_framework.authtoken.views.obtain_auth_token'),
url(r'^oauth2/', include('provider.oauth2.urls', namespace = 'oauth2')),
url(r'^oauth2-test/$', MockView.as_view(authentication_classes=[OAuth2Authentication])),
)
if oauth2_provider is not None:
urlpatterns += patterns('',
url(r'^oauth2/', include('provider.oauth2.urls', namespace = 'oauth2')),
url(r'^oauth2-test/$', MockView.as_view(authentication_classes=[OAuth2Authentication])),
)
class BasicAuthTests(TestCase):
"""Basic authentication"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment