Closed jinty closed 7 years ago
On Thu, Mar 02, 2017 at 02:23:33AM -0800, Marius Gedminas wrote:
mgedmin approved this pull request.
LGTM, with only minor stylistic comments.
:)
Ok Ok, I'll stop being lazy
I'd love to see a traceback of the failure this is fixing somewhere in the pull request description.
@@ -613,7 +613,11 @@ def get(self, key, default=None): class ZopeFieldStorage(FieldStorage):
def make_file(self, binary=None):
- return tempfile.NamedTemporaryFile('w+b')
- if PYTHON2 or self._binary_file:
- return tempfile.NamedTemporaryFile("w+b")
- else:
- return tempfile.NamedTemporaryFile("w+",
- encoding=self.encoding, newline = '\n')
Drop the spaces around
=
here?
Ok, though I'll note those spaces are in the stdlib code I cribbed from. Not that that's any excuse
@@ -220,6 +227,38 @@ def testFileUploadPost(self):
Test that we can actually read the file data
self.assertEqual(request.form['upload'].read(), b'Some data')
- def testFileUploadPost(self):
- """Produce a Fieldstorage with a file handle that exposes
- its filename."""
Remove the docstring? It's not accurate, and some test runners like to use
__doc__
instead of__name__
, obscuring which test it is running. This is especially bad when you have multiple tests with the same docstring, which is the case here.
Ok
- boundary=---------------------------1'}
- request = self._createRequest(extra, body=LARGE_FILE_BODY)
- request.processInputs()
- self.assertTrue(request.form['upload'].name)
- request = self._createRequest(extra, body=IE_FILE_BODY)
- request.processInputs()
- self.assertEqual(request.form['upload'].filename, 'notepad.exe')
Test that we can actually read the file data
- self.assertEqual(request.form['upload'].read(), b'Some data')
- def testLargePost(self):
- """Produce a Fieldstorage with a file handle that exposes
- its filename."""
Same docstring as previous test.
Ok, I fixed this up. It's a much better pull request now. Thanks.
-- Brian Sutherland
LGTM!
Results in a traceback looking like this: