Dear Django fellows,
using Django 1.7.5, I have a problem with commas in string literals in
the cycle tag, e.g. with
{% cycle "Hello, how are you?" "Fine!" %}.
Please consider (newlines added for clarity):
$ ./manage.py shell
>>> 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"'
This happens with or without {% load cycle from future %}
A bug? Or am I doing something wrong?
Best regards,
Carsten
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/54F8834D.7010403%40cafu.de.
For more options, visit https://groups.google.com/d/optout.