diff options
author | Marcel Hellkamp <marc@gsites.de> | 2012-10-04 19:21:16 +0200 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2012-10-04 19:21:16 +0200 |
commit | 96645e845b87d87cf3fc4c01b105ff4240c36108 (patch) | |
tree | 7296fa200c532eaa48a0432d1c6362a4306eaf04 | |
parent | c97c84a47826488a21d2f6fbf8716df914b0fa69 (diff) | |
download | bottle-96645e845b87d87cf3fc4c01b105ff4240c36108.tar.gz |
Fix #382 "Test failures with Python 3"
-rw-r--r-- | bottle.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -122,10 +122,11 @@ if py31: class NCTextIOWrapper(TextIOWrapper): def close(self): pass # Keep wrapped buffer open. -# The truth-value of cgi.FieldStorage is misleading. +# File uploads (which are implemented as empty FiledStorage instances...) +# have a negative truth value. That makes no sense, here is a fix. class FieldStorage(cgi.FieldStorage): - def __nonzero__(self): - return bool(self.list or self.file) + def __nonzero__(self): return bool(self.list or self.file) + if py3k: __bool__ = __nonzero__ # A bug in functools causes it to break if the wrapper is an instance method def update_wrapper(wrapper, wrapped, *a, **ka): |