summaryrefslogtreecommitdiff
path: root/django/http
diff options
context:
space:
mode:
Diffstat (limited to 'django/http')
-rw-r--r--django/http/multipartparser.py7
-rw-r--r--django/http/request.py6
2 files changed, 3 insertions, 10 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 789a6610a5..f6f12ca718 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -277,11 +277,8 @@ class MultiPartParser:
exhaust(self._input_data)
# Signal that the upload has completed.
- for handler in handlers:
- retval = handler.upload_complete()
- if retval:
- break
-
+ # any() shortcircuits if a handler's upload_complete() returns a value.
+ any(handler.upload_complete() for handler in handlers)
self._post._mutable = False
return self._post, self._files
diff --git a/django/http/request.py b/django/http/request.py
index 5a14c2a41a..2538e0a012 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -567,8 +567,4 @@ def validate_host(host, allowed_hosts):
Return ``True`` for a valid host, ``False`` otherwise.
"""
- for pattern in allowed_hosts:
- if pattern == '*' or is_same_domain(host, pattern):
- return True
-
- return False
+ return any(pattern == '*' or is_same_domain(host, pattern) for pattern in allowed_hosts)