Skip to content

Commit

Permalink
renamed OAuthLibMixin attribute 'oauthlib_core_class' to 'oauthlib_ba…
Browse files Browse the repository at this point in the history
…ckend_class'
  • Loading branch information
palazzem committed Apr 18, 2015
1 parent df9e752 commit 6bdee6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions oauth2_provider/tests/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class AnotherOauthLibBackend(object):
class TestView(OAuthLibMixin, View):
server_class = Server
validator_class = OAuth2Validator
oauthlib_core_class = AnotherOauthLibBackend
oauthlib_backend_class = AnotherOauthLibBackend

request = self.request_factory.get("/fake-req")
request.user = "fake"
test_view = TestView()

self.assertEqual(test_view.get_oauthlib_core_class(),
self.assertEqual(test_view.get_oauthlib_backend_class(),
AnotherOauthLibBackend)


Expand Down
12 changes: 5 additions & 7 deletions oauth2_provider/views/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OAuthLibMixin(object):
* server_class
* validator_class
* oauthlib_core_class # TODO rename it as oauthlib_backend_class
* oauthlib_backend_class
"""
server_class = None
Expand Down Expand Up @@ -56,16 +56,14 @@ def get_validator_class(cls):
return cls.validator_class

@classmethod
def get_oauthlib_core_class(cls):
def get_oauthlib_backend_class(cls):
"""
Return the OAuthLibCore implementation class to use, silently
defaults to OAuthLibCore class from oauth2_provider package
# TODO rename this as get_oauthlib_backend_class
"""
if not hasattr(cls, 'oauthlib_core_class'):
if not hasattr(cls, 'oauthlib_backend_class'):
return OAuthLibCore
return cls.oauthlib_core_class
return cls.oauthlib_backend_class

@classmethod
def get_server(cls):
Expand All @@ -84,7 +82,7 @@ def get_oauthlib_core(cls):
"""
if not hasattr(cls, '_oauthlib_core'):
server = cls.get_server()
core_class = cls.get_oauthlib_core_class()
core_class = cls.get_oauthlib_backend_class()
cls._oauthlib_core = core_class(server)
return cls._oauthlib_core

Expand Down

0 comments on commit 6bdee6d

Please sign in to comment.