summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2008-08-01 21:37:38 +0000
committerLuke Plant <L.Plant.98@cantab.net>2008-08-01 21:37:38 +0000
commitff486b9fba1eaffdf204c4b0ee8babf0d3627725 (patch)
tree1d955369b334754374f1d90e0677de07acb2009a
parent8dff194e9b22e05c4146798c7b00bbf48af80213 (diff)
Fixed #3912 - Added simple type checking to template.Context.update() to help debugging broken context processors. Thanks Jeremy Dunck
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8181 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/template/context.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/template/context.py b/django/template/context.py
index 6ba53f340b..8f16a95021 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -62,6 +62,8 @@ class Context(object):
def update(self, other_dict):
"Like dict.update(). Pushes an entire dictionary's keys and values onto the context."
+ if not hasattr(other_dict, '__getitem__'):
+ raise TypeError('other_dict must be a mapping (dictionary-like) object.')
self.dicts = [other_dict] + self.dicts
return other_dict