diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2013-05-10 12:55:30 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2013-05-10 12:55:30 +0100 |
| commit | cb4b0de49e027f09f8abe63e2fa43f60fc1ef13f (patch) | |
| tree | 712da07b2b80fc503aea683c096a8774dceaad01 /django/utils | |
| parent | f6801a234fb9460eac80d146534ac340e178c466 (diff) | |
| parent | bdd285723f9b0044eca690634c412c1c3eec76c0 (diff) | |
Merge branch 'master' into schema-alteration
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/datastructures.py | 8 | ||||
| -rw-r--r-- | django/utils/functional.py | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index ec68892870..b0b1cd6b1d 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -14,13 +14,19 @@ class MergeDict(object): def __init__(self, *dicts): self.dicts = dicts + def __bool__(self): + return any(self.dicts) + + def __nonzero__(self): + return type(self).__bool__(self) + def __getitem__(self, key): for dict_ in self.dicts: try: return dict_[key] except KeyError: pass - raise KeyError + raise KeyError(key) def __copy__(self): return self.__class__(*self.dicts) diff --git a/django/utils/functional.py b/django/utils/functional.py index 13aec9cb82..1592828c7f 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -346,6 +346,7 @@ class SimpleLazyObject(LazyObject): # care about this (especially in equality tests) __class__ = property(new_method_proxy(operator.attrgetter("__class__"))) __eq__ = new_method_proxy(operator.eq) + __ne__ = new_method_proxy(operator.ne) __hash__ = new_method_proxy(hash) __bool__ = new_method_proxy(bool) # Python 3 __nonzero__ = __bool__ # Python 2 |
