Skip to content

Conversation

@dnit
Copy link

@dnit dnit commented Apr 2, 2016

Changing type('') to str

@jpadilla
Copy link
Contributor

jpadilla commented Apr 2, 2016

Seems ok to me.

@xordoquy
Copy link
Contributor

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
Contributor

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
Hide some test client ickyness where the header can be unicode.
"""
auth = request.META.get('HTTP_AUTHORIZATION', b'')
if isinstance(auth, type('')):
Copy link
Contributor

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
Contributor

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.

5 participants