|
|
eff2f9 |
Index: python-multipart-0.0.5/multipart/multipart.py
|
|
|
eff2f9 |
===================================================================
|
|
|
eff2f9 |
--- python-multipart-0.0.5.orig/multipart/multipart.py
|
|
|
eff2f9 |
+++ python-multipart-0.0.5/multipart/multipart.py
|
|
|
eff2f9 |
@@ -1,11 +1,5 @@
|
|
|
eff2f9 |
from __future__ import with_statement, absolute_import, print_function
|
|
|
eff2f9 |
|
|
|
eff2f9 |
-from six import (
|
|
|
eff2f9 |
- binary_type,
|
|
|
eff2f9 |
- text_type,
|
|
|
eff2f9 |
- PY3,
|
|
|
eff2f9 |
-)
|
|
|
eff2f9 |
-
|
|
|
eff2f9 |
from .decoders import *
|
|
|
eff2f9 |
from .exceptions import *
|
|
|
eff2f9 |
|
|
|
eff2f9 |
@@ -74,14 +68,9 @@ NULL = b'\x00'[0]
|
|
|
eff2f9 |
# str on Py2, and bytes on Py3. Same with getting the ordinal value of a byte,
|
|
|
eff2f9 |
# and joining a list of bytes together.
|
|
|
eff2f9 |
# These functions abstract that.
|
|
|
eff2f9 |
-if PY3: # pragma: no cover
|
|
|
eff2f9 |
- lower_char = lambda c: c | 0x20
|
|
|
eff2f9 |
- ord_char = lambda c: c
|
|
|
eff2f9 |
- join_bytes = lambda b: bytes(list(b))
|
|
|
eff2f9 |
-else: # pragma: no cover
|
|
|
eff2f9 |
- lower_char = lambda c: c.lower()
|
|
|
eff2f9 |
- ord_char = lambda c: ord(c)
|
|
|
eff2f9 |
- join_bytes = lambda b: b''.join(list(b))
|
|
|
eff2f9 |
+lower_char = lambda c: c | 0x20
|
|
|
eff2f9 |
+ord_char = lambda c: c
|
|
|
eff2f9 |
+join_bytes = lambda b: bytes(list(b))
|
|
|
eff2f9 |
|
|
|
eff2f9 |
# These are regexes for parsing header values.
|
|
|
eff2f9 |
SPECIAL_CHARS = re.escape(b'()<>@,;:\\"/[]?={} \t')
|
|
|
eff2f9 |
@@ -104,7 +93,7 @@ def parse_options_header(value):
|
|
|
eff2f9 |
|
|
|
eff2f9 |
# If we are passed a string, we assume that it conforms to WSGI and does
|
|
|
eff2f9 |
# not contain any code point that's not in latin-1.
|
|
|
eff2f9 |
- if isinstance(value, text_type): # pragma: no cover
|
|
|
eff2f9 |
+ if isinstance(value, str): # pragma: no cover
|
|
|
eff2f9 |
value = value.encode('latin-1')
|
|
|
eff2f9 |
|
|
|
eff2f9 |
# If we have no options, return the string as-is.
|
|
|
eff2f9 |
@@ -454,13 +443,13 @@ class File(object):
|
|
|
eff2f9 |
options = {}
|
|
|
eff2f9 |
if keep_extensions:
|
|
|
eff2f9 |
ext = self._ext
|
|
|
eff2f9 |
- if isinstance(ext, binary_type):
|
|
|
eff2f9 |
+ if isinstance(ext, bytes):
|
|
|
eff2f9 |
ext = ext.decode(sys.getfilesystemencoding())
|
|
|
eff2f9 |
|
|
|
eff2f9 |
options['suffix'] = ext
|
|
|
eff2f9 |
if file_dir is not None:
|
|
|
eff2f9 |
d = file_dir
|
|
|
eff2f9 |
- if isinstance(d, binary_type):
|
|
|
eff2f9 |
+ if isinstance(d, bytes):
|
|
|
eff2f9 |
d = d.decode(sys.getfilesystemencoding())
|
|
|
eff2f9 |
|
|
|
eff2f9 |
options['dir'] = d
|
|
|
eff2f9 |
@@ -478,7 +467,7 @@ class File(object):
|
|
|
eff2f9 |
fname = tmp_file.name
|
|
|
eff2f9 |
|
|
|
eff2f9 |
# Encode filename as bytes.
|
|
|
eff2f9 |
- if isinstance(fname, text_type):
|
|
|
eff2f9 |
+ if isinstance(fname, str):
|
|
|
eff2f9 |
fname = fname.encode(sys.getfilesystemencoding())
|
|
|
eff2f9 |
|
|
|
eff2f9 |
self._actual_file_name = fname
|
|
|
eff2f9 |
@@ -1037,7 +1026,7 @@ class MultipartParser(BaseParser):
|
|
|
eff2f9 |
# self.skip = tuple(skip)
|
|
|
eff2f9 |
|
|
|
eff2f9 |
# Save our boundary.
|
|
|
eff2f9 |
- if isinstance(boundary, text_type): # pragma: no cover
|
|
|
eff2f9 |
+ if isinstance(boundary, str): # pragma: no cover
|
|
|
eff2f9 |
boundary = boundary.encode('latin-1')
|
|
|
eff2f9 |
self.boundary = b'\r\n--' + boundary
|
|
|
eff2f9 |
|
|
|
eff2f9 |
Index: python-multipart-0.0.5/multipart/tests/test_multipart.py
|
|
|
eff2f9 |
===================================================================
|
|
|
eff2f9 |
--- python-multipart-0.0.5.orig/multipart/tests/test_multipart.py
|
|
|
eff2f9 |
+++ python-multipart-0.0.5/multipart/tests/test_multipart.py
|
|
|
eff2f9 |
@@ -14,7 +14,6 @@ from .compat import (
|
|
|
eff2f9 |
unittest,
|
|
|
eff2f9 |
)
|
|
|
eff2f9 |
from io import BytesIO
|
|
|
eff2f9 |
-from six import binary_type, text_type
|
|
|
eff2f9 |
|
|
|
eff2f9 |
try:
|
|
|
eff2f9 |
from unittest.mock import MagicMock, Mock, patch
|
|
|
eff2f9 |
@@ -29,7 +28,7 @@ curr_dir = os.path.abspath(os.path.dirna
|
|
|
eff2f9 |
|
|
|
eff2f9 |
|
|
|
eff2f9 |
def force_bytes(val):
|
|
|
eff2f9 |
- if isinstance(val, text_type):
|
|
|
eff2f9 |
+ if isinstance(val, str):
|
|
|
eff2f9 |
val = val.encode(sys.getfilesystemencoding())
|
|
|
eff2f9 |
|
|
|
eff2f9 |
return val
|
|
|
eff2f9 |
@@ -799,7 +798,7 @@ class TestFormParser(unittest.TestCase):
|
|
|
eff2f9 |
def test_http(self, param):
|
|
|
eff2f9 |
# Firstly, create our parser with the given boundary.
|
|
|
eff2f9 |
boundary = param['result']['boundary']
|
|
|
eff2f9 |
- if isinstance(boundary, text_type):
|
|
|
eff2f9 |
+ if isinstance(boundary, str):
|
|
|
eff2f9 |
boundary = boundary.encode('latin-1')
|
|
|
eff2f9 |
self.make(boundary)
|
|
|
eff2f9 |
|
|
|
eff2f9 |
Index: python-multipart-0.0.5/multipart/exceptions.py
|
|
|
eff2f9 |
===================================================================
|
|
|
eff2f9 |
--- python-multipart-0.0.5.orig/multipart/exceptions.py
|
|
|
eff2f9 |
+++ python-multipart-0.0.5/multipart/exceptions.py
|
|
|
eff2f9 |
@@ -1,7 +1,5 @@
|
|
|
eff2f9 |
import binascii
|
|
|
eff2f9 |
|
|
|
eff2f9 |
-from six import PY3
|
|
|
eff2f9 |
-
|
|
|
eff2f9 |
|
|
|
eff2f9 |
class FormParserError(ValueError):
|
|
|
eff2f9 |
"""Base error class for our form parser."""
|
|
|
eff2f9 |
@@ -52,7 +50,4 @@ else: # pragma
|
|
|
eff2f9 |
|
|
|
eff2f9 |
# We check which version of Python we're on to figure out what error we need
|
|
|
eff2f9 |
# to catch for invalid Base64.
|
|
|
eff2f9 |
-if PY3: # pragma: no cover
|
|
|
eff2f9 |
Base64Error = binascii.Error
|
|
|
eff2f9 |
-else: # pragma: no cover
|
|
|
eff2f9 |
- Base64Error = TypeError
|
|
|
5fab02 |
Index: python-multipart-0.0.5/setup.py
|
|
|
5fab02 |
===================================================================
|
|
|
5fab02 |
--- python-multipart-0.0.5.orig/setup.py
|
|
|
5fab02 |
+++ python-multipart-0.0.5/setup.py
|
|
|
5fab02 |
@@ -25,7 +25,6 @@ setup(name='python-multipart',
|
|
|
5fab02 |
platforms='any',
|
|
|
5fab02 |
zip_safe=False,
|
|
|
5fab02 |
install_requires=[
|
|
|
5fab02 |
- 'six>=1.4.0',
|
|
|
5fab02 |
],
|
|
|
5fab02 |
tests_require=[
|
|
|
5fab02 |
'pytest',
|