diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-12-01 11:38:01 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-18 16:21:28 +0100 |
| commit | c716fe87821df00f9f03ecc761c914d1682591a2 (patch) | |
| tree | 0436706cdb190acbc76fb5fcf6d66f16e09fafa3 /django/http/multipartparser.py | |
| parent | e63d98b7beb16d1410168a2315cbe04c43c9c80d (diff) | |
Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
Diffstat (limited to 'django/http/multipartparser.py')
| -rw-r--r-- | django/http/multipartparser.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py index ecfbdf7252..812e83eff0 100644 --- a/django/http/multipartparser.py +++ b/django/http/multipartparser.py @@ -40,8 +40,6 @@ RAW = "raw" FILE = "file" FIELD = "field" -_BASE64_DECODE_ERROR = TypeError if six.PY2 else binascii.Error - class MultiPartParser(object): """ @@ -190,7 +188,7 @@ class MultiPartParser(object): num_bytes_read += len(raw_data) try: data = base64.b64decode(raw_data) - except _BASE64_DECODE_ERROR: + except binascii.Error: data = raw_data else: data = field_stream.read(size=read_size) @@ -684,10 +682,7 @@ def parse_header(line): value = p[i + 1:].strip() if has_encoding: encoding, lang, value = value.split(b"'") - if six.PY3: - value = unquote(value.decode(), encoding=encoding.decode()) - else: - value = unquote(value).decode(encoding) + value = unquote(value.decode(), encoding=encoding.decode()) if len(value) >= 2 and value[:1] == value[-1:] == b'"': value = value[1:-1] value = value.replace(b'\\\\', b'\\').replace(b'\\"', b'"') |
