app/django/template/context.py
changeset 323 ff1a9aa48cfd
parent 54 03e267d67478
equal deleted inserted replaced
322:6641e941ef1e 323:ff1a9aa48cfd
    60                 return d[key]
    60                 return d[key]
    61         return otherwise
    61         return otherwise
    62 
    62 
    63     def update(self, other_dict):
    63     def update(self, other_dict):
    64         "Like dict.update(). Pushes an entire dictionary's keys and values onto the context."
    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         self.dicts = [other_dict] + self.dicts
    67         self.dicts = [other_dict] + self.dicts
    66         return other_dict
    68         return other_dict
    67 
    69 
    68 # This is a function rather than module-level procedural code because we only
    70 # This is a function rather than module-level procedural code because we only
    69 # want it to execute if somebody uses RequestContext.
    71 # want it to execute if somebody uses RequestContext.