Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit ff486b9fba1eaffdf204c4b0ee8babf0d3627725 1 parent 8dff194
Luke Plant authored August 01, 2008

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  django/template/context.py
2  django/template/context.py
@@ -62,6 +62,8 @@ def get(self, key, otherwise=None):
62 62
 
63 63
     def update(self, other_dict):
64 64
         "Like dict.update(). Pushes an entire dictionary's keys and values onto the context."
  65
+        if not hasattr(other_dict, '__getitem__'): 
  66
+            raise TypeError('other_dict must be a mapping (dictionary-like) object.')
65 67
         self.dicts = [other_dict] + self.dicts
66 68
         return other_dict
67 69
 

0 notes on commit ff486b9

Please sign in to comment.
Something went wrong with that request. Please try again.