Use six when checking for strings.

This commit is contained in:
RM Saksida
2014-11-11 01:41:32 -02:00
parent 3956b952e0
commit bec7c53d97
2 changed files with 2 additions and 6 deletions

View File

@@ -1806,7 +1806,7 @@ class OAuth2WebServerFlow(Flow):
if code is None:
code = device_flow_info.device_code
elif not isinstance(code, basestring):
elif not isinstance(code, six.string_types):
if 'code' not in code:
raise FlowExchangeError(code.get(
'error', 'No code was supplied in the query parameters.'))

View File

@@ -152,11 +152,7 @@ def scopes_to_string(scopes):
Returns:
The scopes formatted as a single string.
"""
try:
is_string = isinstance(scopes, basestring)
except NameError:
is_string = isinstance(scopes, str)
if is_string:
if isinstance(scopes, six.string_types):
return scopes
else:
return ' '.join(scopes)