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/datastructures.py | |
parent | f6801a234fb9460eac80d146534ac340e178c466 (diff) | |
parent | bdd285723f9b0044eca690634c412c1c3eec76c0 (diff) | |
download | django-cb4b0de49e027f09f8abe63e2fa43f60fc1ef13f.tar.gz |
Merge branch 'master' into schema-alteration
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r-- | django/utils/datastructures.py | 8 |
1 files changed, 7 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) |