diff options
author | Дилян Палаузов <Dilyan.Palauzov@db.com> | 2017-12-27 00:14:12 +0530 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-12-26 17:11:15 -0500 |
commit | 4c599ece57fa009cf3615f09497f81bfa6a585a7 (patch) | |
tree | 1f27a7e76024aaa5bc69356826061262d35d0be3 /django/http/request.py | |
parent | c21f158295d92e35caf96436bfdbbff554fc5569 (diff) | |
download | django-4c599ece57fa009cf3615f09497f81bfa6a585a7.tar.gz |
Fixed #28930 -- Simplified code with any() and all().
Diffstat (limited to 'django/http/request.py')
-rw-r--r-- | django/http/request.py | 6 |
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) |