summaryrefslogtreecommitdiff
path: root/django/http/multipartparser.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-04 08:08:27 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit7119f40c9881666b6f9b5cf7df09ee1d21cc8344 (patch)
treefa50869f5614295f462d9bf77fec59365c621609 /django/http/multipartparser.py
parent9c19aff7c7561e3a82978a272ecdaad40dda5c00 (diff)
Refs #33476 -- Refactored code to strictly match 88 characters line length.
Diffstat (limited to 'django/http/multipartparser.py')
-rw-r--r--django/http/multipartparser.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 13ed2fa4cd..f52ff7619e 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -218,7 +218,8 @@ class MultiPartParser:
and num_bytes_read > settings.DATA_UPLOAD_MAX_MEMORY_SIZE
):
raise RequestDataTooBig(
- "Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE."
+ "Request body exceeded "
+ "settings.DATA_UPLOAD_MAX_MEMORY_SIZE."
)
self._post.appendlist(
@@ -263,8 +264,8 @@ class MultiPartParser:
for chunk in field_stream:
if transfer_encoding == "base64":
# We only special-case base64 transfer encoding
- # We should always decode base64 chunks by multiple of 4,
- # ignoring whitespace.
+ # We should always decode base64 chunks by
+ # multiple of 4, ignoring whitespace.
stripped_chunk = b"".join(chunk.split())
@@ -279,7 +280,8 @@ class MultiPartParser:
try:
chunk = base64.b64decode(stripped_chunk)
except Exception as exc:
- # Since this is only a chunk, any error is an unfixable error.
+ # Since this is only a chunk, any error is
+ # an unfixable error.
raise MultiPartParserError(
"Could not decode base64 data."
) from exc
@@ -362,7 +364,8 @@ class MultiPartParser:
def _close_files(self):
# Free up all file handles.
# FIXME: this currently assumes that upload handlers store the file as 'file'
- # We should document that... (Maybe add handler.free_file to complement new_file)
+ # We should document that...
+ # (Maybe add handler.free_file to complement new_file)
for handler in self._upload_handlers:
if hasattr(handler, "file"):
handler.file.close()