#28002: named cycle tags don't work if cycle is instantiated outside included
template
---------------------------------+--------------------------------------
     Reporter:  kapil garg       |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Template system  |                  Version:  master
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by kapil garg):

 If we use the cycle variable inside the included template like a normal
 variable then there is no problem but if we try to cycle through the
 variable in included template then it will raise TemplateSyntax Error.

 {{{
 def test_cycle():
         engine = Engine(loaders=[
             ('django.template.loaders.locmem.Loader', {
                 'template': '{%cycle "a" "b" "c" as cycler silent%}{% for
 x in vars %}{% include "include" %}{% endfor %}',
                 'include': '{% cycle cycler %}',
             }),
         ])
         output = engine.render_to_string('template', dict(vars=range(10)))
         print(output)
 }}}
 The above code raises TemplateSyntaxError for "include" template because
 for this template the "cycler" name has never been introduced before.

--
Ticket URL: <https://code.djangoproject.com/ticket/28002#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.07266d267b875b828fdc7aa4bf87664f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to