diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2016-11-18 00:00:16 -0700 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2016-11-18 00:05:44 -0700 |
commit | 2d4436714dbca67725f6f35ea25e40b5e9bb90fd (patch) | |
tree | e9534b78b8e574ce35fb445fe82b173739049a10 | |
parent | 4ab350d146e37bdca88b72896a4f7bae5d6f3b6e (diff) | |
download | webob-bugfix/cgi_FieldStorage.tar.gz |
FieldStorage.read_multi needs fixup until Python bug 27777 is closedbugfix/cgi_FieldStorage
-rw-r--r-- | webob/compat.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/webob/compat.py b/webob/compat.py index cc41af6..0337ac6 100644 --- a/webob/compat.py +++ b/webob/compat.py @@ -140,9 +140,10 @@ if PY3: if sys.version_info[:3] < (3, 7, 0): # pragma no cover # Assume that this will be fixed in Python 3.7 - # Work around https://bugs.python.org/issue27777 class cgi_FieldStorage(_cgi_FieldStorage): + + # Work around https://bugs.python.org/issue27777 def make_file(self): if self._binary_file or self.length >= 0: return tempfile.TemporaryFile("wb+") @@ -152,14 +153,8 @@ if PY3: encoding=self.encoding, newline='\n' ) - _cgi_FieldStorage = cgi_FieldStorage - - if sys.version_info[:3] < (3, 4, 4): # pragma no cover - # Work around http://bugs.python.org/issue23801 - - class cgi_FieldStorage(_cgi_FieldStorage): - # This is taken exactly from Python 3.5's cgi.py module, and patched - # with the patch from http://bugs.python.org/issue23801. + # Work around http://bugs.python.org/issue23801 + # This is taken exactly from Python 3.5's cgi.py module def read_multi(self, environ, keep_blank_values, strict_parsing): """Internal: read a part that is itself multipart.""" ib = self.innerboundary @@ -210,5 +205,8 @@ if PY3: if part.done or self.bytes_read >= self.length > 0: break self.skip_lines() + else: # pragma no cover + cgi_FieldStorage = _cgi_FieldStorage + else: from cgi import FieldStorage as cgi_FieldStorage |