#24451: TemplateSyntaxError with {% cycle "Hello, how are you?" "Fine!" %}
---------------------------------+--------------------
Reporter: CarstenF | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
Originating thread at django-users:
https://groups.google.com/forum/#!topic/django-users/hSqSVpWMDqs
Using Django 1.7.5, there is a problem with commas in string literals in
the cycle tag, e.g. with
{{{
{% cycle "Hello, how are you?" "Fine!" %}
}}}
Please consider this example in the management shell (newlines added for
clarity):
{{{
#!python
>>> from django.template import *
>>> t = Template('''{% cycle "Hello, how are you?" "Fine!" %}''')
/home/carsten/.virtualenvs/Ze/local/lib/python2.7/site-
packages/django/template/base.py:290: RemovedInDjango18Warning: 'The
`cycle` template tag is changing to escape its arguments; the non-
autoescaping version is deprecated. Load it from the `future` tag library
to start using the new behavior.
compiled_result = compile_func(self, token)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/carsten/.virtualenvs/Ze/local/lib/python2.7/site-
packages/django/template/base.py", line 132, in __init__
self.nodelist = compile_string(template_string, origin)
File "/home/carsten/.virtualenvs/Ze/local/lib/python2.7/site-
packages/django/template/base.py", line 162, in compile_string
return parser.parse()
File "/home/carsten/.virtualenvs/Ze/local/lib/python2.7/site-
packages/django/template/base.py", line 290, in parse
compiled_result = compile_func(self, token)
File "/home/carsten/.virtualenvs/Ze/local/lib/python2.7/site-
packages/django/template/defaulttags.py", line 648, in cycle
values = [parser.compile_filter(arg) for arg in args[1:]]
File "/home/carsten/.virtualenvs/Ze/local/lib/python2.7/site-
packages/django/template/base.py", line 372, in compile_filter
return FilterExpression(token, self)
File "/home/carsten/.virtualenvs/Ze/local/lib/python2.7/site-
packages/django/template/base.py", line 588, in __init__
"from '%s'" % (token[upto:], token))
TemplateSyntaxError: Could not parse the remainder: 'Hello"' from
'""Hello"'
}}}
(Probably not relevant, but fyi, this happens with or without `{% load
cycle from future %}`.)
--
Ticket URL: <https://code.djangoproject.com/ticket/24451>
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/051.85a98b8fbc814318c0106b1cc6cc6368%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.