Skip to content

Fix ASCII/Unicode handling in Python 2 and 3#218

Merged
brandur merged 1 commit intomasterfrom
ob-fix-217
Mar 24, 2016
Merged

Fix ASCII/Unicode handling in Python 2 and 3#218
brandur merged 1 commit intomasterfrom
ob-fix-217

Conversation

@olivierbellone
Copy link
Contributor

Fixes #217.

This PR ensures that MultipartDataGenerator can handle keys and values of all encodings in both Python 2 and 3.

self._write(key)
self._write("\"; filename=\"")
self._write(value.name)
self._write("\"")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the code to not rely on Python's string formatting to handle the (admittedly improbable) case where the key is a byte array.

@brandur
Copy link
Contributor

brandur commented Mar 24, 2016

Amazing work @olivierbellone! Let's get this out.

@brandur brandur merged commit 5cd00d8 into master Mar 24, 2016
@brandur brandur deleted the ob-fix-217 branch March 24, 2016 17:31
@brandur
Copy link
Contributor

brandur commented Mar 24, 2016

Released as 1.31.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants