Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
type('') to str
  • Loading branch information
niteshCoditas committed Apr 2, 2016
commit c22b92a66ca3bb740b8561f660883149953026e0
2 changes: 1 addition & 1 deletion rest_framework/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,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('')):
if isinstance(auth, str):
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.

# Work around django test client oddness
auth = auth.encode(HTTP_HEADER_ENCODING)
return auth
Expand Down