summaryrefslogtreecommitdiff
path: root/django/http/request.py
diff options
context:
space:
mode:
authorДилян Палаузов <Dilyan.Palauzov@db.com>2017-12-27 00:14:12 +0530
committerTim Graham <timograham@gmail.com>2017-12-26 17:11:15 -0500
commit4c599ece57fa009cf3615f09497f81bfa6a585a7 (patch)
tree1f27a7e76024aaa5bc69356826061262d35d0be3 /django/http/request.py
parentc21f158295d92e35caf96436bfdbbff554fc5569 (diff)
downloaddjango-4c599ece57fa009cf3615f09497f81bfa6a585a7.tar.gz
Fixed #28930 -- Simplified code with any() and all().
Diffstat (limited to 'django/http/request.py')
-rw-r--r--django/http/request.py6
1 files changed, 1 insertions, 5 deletions
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)