Django

Code

Show
Ignore:
Timestamp:
06/26/08 10:42:33 (5 months ago)
Author:
brosner
Message:

newforms-admin: Merged from trunk up to [7766].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin

    • Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7729 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7768
  • django/branches/newforms-admin/django/template/defaulttags.py

    r7584 r7770  
    4040class CycleNode(Node): 
    4141    def __init__(self, cyclevars, variable_name=None): 
    42         self.cycle_iter = itertools_cycle(cyclevars
     42        self.cycle_iter = itertools_cycle([Variable(v) for v in cyclevars]
    4343        self.variable_name = variable_name 
    4444 
    4545    def render(self, context): 
    46         value = self.cycle_iter.next() 
    47         value = Variable(value).resolve(context) 
     46        value = self.cycle_iter.next().resolve(context) 
    4847        if self.variable_name: 
    4948            context[self.variable_name] = value 
     
    163162        self._last_seen = None 
    164163        self._varlist = map(Variable, varlist) 
    165  
    166     def render(self, context): 
    167         if 'forloop' in context and context['forloop']['first']: 
     164        self._id = str(id(self)) 
     165 
     166    def render(self, context): 
     167        if 'forloop' in context and self._id not in context['forloop']: 
    168168            self._last_seen = None 
     169            context['forloop'][self._id] = 1 
    169170        try: 
    170171            if self._varlist: 
     
    453454            <tr class="{% cycle rowcolors %}">...</tr> 
    454455 
    455     You can use any number of values, seperated by spaces. Commas can also 
     456    You can use any number of values, separated by spaces. Commas can also 
    456457    be used to separate values; if a comma is used, the cycle values are 
    457458    interpreted as literal strings. 
     
    460461    # Note: This returns the exact same node on each {% cycle name %} call; 
    461462    # that is, the node object returned from {% cycle a b c as name %} and the 
    462     # one returned from {% cycle name %} are the exact same object. This 
     463    # one returned from {% cycle name %} are the exact same object. This 
    463464    # shouldn't cause problems (heh), but if it does, now you know. 
    464465    # 
    465     # Ugly hack warning: this stuffs the named template dict into parser so 
     466    # Ugly hack warning: This stuffs the named template dict into parser so 
    466467    # that names are only unique within each template (as opposed to using 
    467468    # a global variable, which would make cycle names have to be unique across 
     
    482483        name = args[1] 
    483484        if not hasattr(parser, '_namedCycleNodes'): 
    484             raise TemplateSyntaxError("No named cycles in template." 
    485                                       " '%s' is not defined" % name) 
     485            raise TemplateSyntaxError("No named cycles in template. '%s' is not defined" % name) 
    486486        if not name in parser._namedCycleNodes: 
    487487            raise TemplateSyntaxError("Named cycle '%s' does not exist" % name) 
     
    683683    """ 
    684684    The ``{% if %}`` tag evaluates a variable, and if that variable is "true" 
    685     (i.e. exists, is not empty, and is not a false boolean value) the contents 
    686     of the block are output:: 
     685    (i.e., exists, is not empty, and is not a false boolean value), the 
     686    contents of the block are output: 
     687 
     688    :: 
    687689 
    688690        {% if athlete_list %}