Skip to content

Commit

Permalink
Merge pull request #47 from zopefoundation/fix-file-upload
Browse files Browse the repository at this point in the history
Support FileUpload.seekable()
  • Loading branch information
mgedmin authored Jul 10, 2019
2 parents 02e5f31 + c258f55 commit 8f3e22e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

- Drop support for Python 3.4.

- ``FileUpload`` objects now support the ``seekable()`` method on Python 3.
Fixes `issue 44 <https://github.com/zopefoundation/zope.publisher/issue/44>`_.


5.0.1 (2018-10-19)
==================
Expand Down
2 changes: 1 addition & 1 deletion src/zope/publisher/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def __init__(self, aFieldStorage):
methods = ['close', 'fileno', 'flush', 'isatty',
'read', 'readline', 'readlines', 'seek',
'tell', 'truncate', 'write', 'writelines',
'name']
'name', 'seekable']

d = self.__dict__
for m in methods:
Expand Down
4 changes: 4 additions & 0 deletions src/zope/publisher/tests/test_browserrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ def testFileUploadPost(self):
# Test that we can actually read the file data
self.assertEqual(request.form['upload'].read(), b'Some data')

if not PYTHON2:
# File objects on Python 3 have a seekable() method
self.assertTrue(request.form['upload'].seekable())

def testLargePostValue(self):
extra = {'REQUEST_METHOD':'POST',
'PATH_INFO': u"/",
Expand Down

0 comments on commit 8f3e22e

Please sign in to comment.