Ticket #4563: expand-context-api.patch

File expand-context-api.patch, 945 bytes (added by (removed), 17 years ago)
  • django/template/context.py

    === modified file 'django/template/context.py'
     
    2121            yield d
    2222
    2323    def push(self):
    24         self.dicts = [{}] + self.dicts
     24        d = {}
     25        self.dicts = [d] + self.dicts
     26        return d
    2527
    2628    def pop(self):
    2729        if len(self.dicts) == 1:
    2830            raise ContextPopException
    29         del self.dicts[0]
     31        return self.dicts.pop(0)
    3032
    3133    def __setitem__(self, key, value):
    3234        "Set a variable in the current context"
     
    6163    def update(self, other_dict):
    6264        "Like dict.update(). Pushes an entire dictionary's keys and values onto the context."
    6365        self.dicts = [other_dict] + self.dicts
     66        return other_dict
    6467
    6568# This is a function rather than module-level procedural code because we only
    6669# want it to execute if somebody uses RequestContext.
Back to Top