Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
8845c0be
Commit
8845c0be
authored
Mar 03, 2013
by
Pierre Dulac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix import errors
parent
30e3775b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
rest_framework/compat.py
+7
-0
rest_framework/runtests/settings.py
+1
-1
rest_framework/tests/authentication.py
+6
-2
No files found.
rest_framework/compat.py
View file @
8845c0be
...
...
@@ -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
rest_framework/runtests/settings.py
View file @
8845c0be
...
...
@@ -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"
)
...
...
rest_framework/tests/authentication.py
View file @
8845c0be
...
...
@@ -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"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment