diff options
| author | Thomas Chaumeny <thomas.chaumeny@polyconseil.fr> | 2014-10-16 12:43:46 +0200 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2014-10-16 14:16:24 +0200 |
| commit | b962653060f1968f5a2647b8a20259dc30a3433f (patch) | |
| tree | 8a82b9029c9f55ed8bd3ff82f2b4c8b9c60e30d0 /django/utils | |
| parent | 2e5b2c612ec3b410d2a35133d073341e6958eeba (diff) | |
Fixed #23664 -- Provided a consistent definition for OrderedSet.__bool__
This also defines QuerySet.__bool__ for consistency though this should not have any consequence as bool(qs) used to fallback on QuerySet.__len__ in Py3.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/datastructures.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 2efcd00eb0..49fd9d9848 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -271,9 +271,12 @@ class OrderedSet(object): def __contains__(self, item): return item in self.dict - def __nonzero__(self): + def __bool__(self): return bool(self.dict) + def __nonzero__(self): # Python 2 compatibility + return type(self).__bool__(self) + class MultiValueDictKeyError(KeyError): pass |
