diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2014-02-15 22:58:03 +0100 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2014-02-15 22:58:03 +0100 |
| commit | 9db4271bd11ac23a5a5652bbcdf8fb6d4b997651 (patch) | |
| tree | 07f0d797b0c9f34726c0ec1de68f4179d899cedc /django | |
| parent | f46ef750b9d08ef6081ab57428201028d77adb53 (diff) | |
Fixed bad comparison logic introduced in d97bf2e9c8971764690caaf81a0914bc368d6b02.
Refs #21765.
Thanks to kezabelle for the quick report and to onjin
for providing the patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/template/context.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/django/template/context.py b/django/template/context.py index 9982b85f6d..b2f00abd31 100644 --- a/django/template/context.py +++ b/django/template/context.py @@ -102,7 +102,15 @@ class BaseContext(object): Compares two contexts by comparing theirs 'dicts' attributes. """ if isinstance(other, BaseContext): - return self.dicts[-1] == other.dicts[-1] + # because dictionaries can be put in different order + # we have to flatten them like in templates + def flatten(dicts): + flat = {} + for d in dicts: + flat.update(d) + return flat + + return flatten(self.dicts) == flatten(other.dicts) # if it's not comparable return false return False |
