diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2016-03-15 22:45:15 -0600 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2016-03-15 22:45:15 -0600 |
commit | ee3efc9a42c2220e37db94ef9929a68b58356763 (patch) | |
tree | f157690358ec8fbb258c50e85e1553e06aa1c5f4 | |
parent | 7210c6048770d90089219db553eb968c64a60b42 (diff) | |
parent | ef5a1a29cb605e6f83ddd7846f04b142f1e7971f (diff) | |
download | waitress-ee3efc9a42c2220e37db94ef9929a68b58356763.tar.gz |
Merge branch 'fix/app_iter_falsy'
Closes pr #82
-rw-r--r-- | CHANGES.txt | 6 | ||||
-rw-r--r-- | waitress/buffers.py | 2 | ||||
-rw-r--r-- | waitress/tests/test_buffers.py | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 71e4567..937a10d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,12 @@ Next release ------------ +- FileBasedBuffer and more important ReadOnlyFileBasedBuffer no longer report + False when tested with bool(), instead always returning True, and becoming + more iterator like. + See: https://github.com/Pylons/waitress/pull/82 and + https://github.com/Pylons/waitress/issues/76 + - Waitress will no longer accept headers with newline/carriage returns in them, thereby disallowing HTTP Response Splitting. See https://github.com/Pylons/waitress/issues/117 for more information, as well diff --git a/waitress/buffers.py b/waitress/buffers.py index f174a79..cacc094 100644 --- a/waitress/buffers.py +++ b/waitress/buffers.py @@ -44,7 +44,7 @@ class FileBasedBuffer(object): return self.remain def __nonzero__(self): - return self.remain > 0 + return True __bool__ = __nonzero__ # py3 diff --git a/waitress/tests/test_buffers.py b/waitress/tests/test_buffers.py index 8a4ce6e..46a215e 100644 --- a/waitress/tests/test_buffers.py +++ b/waitress/tests/test_buffers.py @@ -31,7 +31,7 @@ class TestFileBasedBuffer(unittest.TestCase): inst.remain = 10 self.assertEqual(bool(inst), True) inst.remain = 0 - self.assertEqual(bool(inst), False) + self.assertEqual(bool(inst), True) def test_append(self): f = io.BytesIO(b'data') |