Skip to content

Commit

Permalink
Always convert an uploaded file to a string, don't pass files just be…
Browse files Browse the repository at this point in the history
…cause they're real files.
  • Loading branch information
MatthewWilkes committed Feb 2, 2017
1 parent f6f605c commit ed6db88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -8,6 +8,8 @@ CHANGES
- Fixed browser to only follow redirects for HTTP statuses
301, 302, 303, and 307; not other 30x statuses such as 304.

- Fix passing a real file to ``add_file``.


5.1 (2017-01-31)
----------------
Expand Down
2 changes: 1 addition & 1 deletion src/zope/testbrowser/browser.py
Expand Up @@ -698,7 +698,7 @@ def add_file(self, file, content_type, filename):
raise TypeError("Can't call add_file on %s controls"
% self.mech_control.type)

if isinstance(file, io.IOBase):
if hasattr(file, 'read'):
contents = file.read()
else:
contents = file
Expand Down

0 comments on commit ed6db88

Please sign in to comment.