diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-04 08:08:27 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-07 20:37:05 +0100 |
| commit | 7119f40c9881666b6f9b5cf7df09ee1d21cc8344 (patch) | |
| tree | fa50869f5614295f462d9bf77fec59365c621609 /django/http | |
| parent | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 (diff) | |
Refs #33476 -- Refactored code to strictly match 88 characters line length.
Diffstat (limited to 'django/http')
| -rw-r--r-- | django/http/multipartparser.py | 13 | ||||
| -rw-r--r-- | django/http/request.py | 11 |
2 files changed, 16 insertions, 8 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() diff --git a/django/http/request.py b/django/http/request.py index d975aadf25..0b64b1b2b9 100644 --- a/django/http/request.py +++ b/django/http/request.py @@ -256,7 +256,8 @@ class HttpRequest: header, secure_value = settings.SECURE_PROXY_SSL_HEADER except ValueError: raise ImproperlyConfigured( - "The SECURE_PROXY_SSL_HEADER setting must be a tuple containing two values." + "The SECURE_PROXY_SSL_HEADER setting must be a tuple containing " + "two values." ) header_value = self.META.get(header) if header_value is not None: @@ -300,7 +301,8 @@ class HttpRequest: def upload_handlers(self, upload_handlers): if hasattr(self, "_files"): raise AttributeError( - "You cannot set the upload handlers after the upload has been processed." + "You cannot set the upload handlers after the upload has been " + "processed." ) self._upload_handlers = upload_handlers @@ -308,7 +310,10 @@ class HttpRequest: """Return a tuple of (POST QueryDict, FILES MultiValueDict).""" self.upload_handlers = ImmutableList( self.upload_handlers, - warning="You cannot alter upload handlers after the upload has been processed.", + warning=( + "You cannot alter upload handlers after the upload has been " + "processed." + ), ) parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding) return parser.parse() |
