-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type('') to str #4025
type('') to str #4025
Conversation
Seems ok to me. |
This will not work on both Python 2.x and 3.x. |
0e39cb6
to
c22b92a
Compare
@@ -19,7 +20,7 @@ def get_authorization_header(request): | |||
Hide some test client ickyness where the header can be unicode. | |||
""" | |||
auth = request.META.get('HTTP_AUTHORIZATION', b'') | |||
if isinstance(auth, type('')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we've just changed the meaning here. string_types
includes both binary and unicode. type('')
with from __future__ import unicode_literals
will always only be unicode.
I think we should probably have if isinstance(auth, text_type)
, to preserve the meaning, as the intent is to encode unicode into bytestrings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Will correct that today.
Changing type('') to str