Skip to content

Commit 020cb38

Browse files
committed
Change super(ThisClass, self).foo() to self.foo()
Back then (at commit 7bec95b), both the base class and the ThisClass have same-name method get_token(), so I had to use: super(ThisClass, self).get_token() notation to differentiate them. But since the implementation of get_token_by_refresh_token() at commit 33ab177, I changed the base class method name to a different name _get_token(). So now I can come back to the easy way to do it.
1 parent f7817f9 commit 020cb38

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

msal/oauth2.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def authorization_url(
9696
:param scope: It is a space-delimited, case-sensitive string.
9797
Some ID provider can accept empty string to represent default scope.
9898
"""
99-
return super(AuthorizationCodeGrant, self)._authorization_url(
99+
return self._authorization_url(
100100
'code', redirect_uri=redirect_uri, scope=scope, state=state,
101101
**kwargs)
102102
# Later when you receive the response at your redirect_uri,
@@ -114,7 +114,7 @@ def get_token(self, code, redirect_uri=None, **kwargs):
114114
:param client_id: Required, if the client is not authenticating itself.
115115
See https://tools.ietf.org/html/rfc6749#section-3.2.1
116116
"""
117-
return super(AuthorizationCodeGrant, self)._get_token(
117+
return self._get_token(
118118
'authorization_code', code=code,
119119
redirect_uri=redirect_uri, **kwargs)
120120

@@ -137,13 +137,12 @@ class ImplicitGrant(Client):
137137
Quoted from https://tools.ietf.org/html/rfc6749#section-4.2
138138
"""
139139
def authorization_url(self, redirect_uri=None, scope=None, state=None):
140-
return super(ImplicitGrant, self)._authorization_url(
141-
'token', **locals())
140+
return self._authorization_url('token', **locals())
142141

143142

144143
class ResourceOwnerPasswordCredentialsGrant(Client): # Legacy Application flow
145144
def get_token(self, username, password, scope=None, **kwargs):
146-
return super(ResourceOwnerPasswordCredentialsGrant, self)._get_token(
145+
return self._get_token(
147146
"password", username=username, password=password, scope=scope,
148147
**kwargs)
149148

@@ -156,6 +155,5 @@ def get_token(self, scope=None, **kwargs):
156155
or you can provide such extra parameters as `default_body` during the
157156
class initialization.
158157
'''
159-
return super(ClientCredentialGrant, self)._get_token(
160-
"client_credentials", scope=scope, **kwargs)
158+
return self._get_token("client_credentials", scope=scope, **kwargs)
161159

0 commit comments

Comments
 (0)