1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #28930 -- Simplified code with any() and all().

This commit is contained in:
Дилян Палаузов
2017-12-27 00:14:12 +05:30
committed by Tim Graham
parent c21f158295
commit 4c599ece57
18 changed files with 54 additions and 115 deletions

View File

@@ -87,10 +87,7 @@ class BaseContext:
del self.dicts[-1][key]
def __contains__(self, key):
for d in self.dicts:
if key in d:
return True
return False
return any(key in d for d in self.dicts)
def get(self, key, otherwise=None):
for d in reversed(self.dicts):