Django

Code

Changeset 6854

Show
Ignore:
Timestamp:
12/02/07 17:57:22 (1 year ago)
Author:
mtredinnick
Message:

Fixed #4563 -- Context.pop/push/update return the top-level dictionary (the new
one for push() and update(), the one removed for pop()). Based on a patch from
Brian Harring.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/template/context.py

    r6671 r6854  
    2424 
    2525    def push(self): 
    26         self.dicts = [{}] + self.dicts 
     26        d = {} 
     27        self.dicts = [d] + self.dicts 
     28        return d 
    2729 
    2830    def pop(self): 
    2931        if len(self.dicts) == 1: 
    3032            raise ContextPopException 
    31         del self.dicts[0] 
     33        return self.dicts.pop(0) 
    3234 
    3335    def __setitem__(self, key, value): 
     
    6365        "Like dict.update(). Pushes an entire dictionary's keys and values onto the context." 
    6466        self.dicts = [other_dict] + self.dicts 
     67        return other_dict 
    6568 
    6669# This is a function rather than module-level procedural code because we only 
  • django/trunk/tests/regressiontests/templates/tests.py

    r6729 r6854  
    1919 
    2020from unicode import unicode_tests 
     21from context import context_tests 
    2122import filters 
    2223 
     
    2425__test__ = { 
    2526        'unicode': unicode_tests, 
     27        'context': context_tests, 
    2628} 
    2729