Skip to content
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

Merged
merged 2 commits into from Apr 3, 2016
Merged

type('') to str #4025

merged 2 commits into from Apr 3, 2016

Conversation

dnit
Copy link

@dnit dnit commented Apr 2, 2016

Changing type('') to str

@jpadilla
Copy link
Member

jpadilla commented Apr 2, 2016

Seems ok to me.

@xordoquy
Copy link
Collaborator

xordoquy commented Apr 3, 2016

This will not work on both Python 2.x and 3.x.
You should use six.string_types instead.

@dnit dnit closed this Apr 3, 2016
@dnit dnit reopened this Apr 3, 2016
@dnit dnit force-pushed the master branch 2 times, most recently from 0e39cb6 to c22b92a Compare April 3, 2016 12:37
@jpadilla
Copy link
Member

jpadilla commented Apr 3, 2016

Ah yes, thanks @xordoquy for the extra eyes on that. @dnit merging this now, thanks!

@jpadilla jpadilla merged commit dd3b47c into encode:master Apr 3, 2016
@@ -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('')):
Copy link
Member

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.

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants