Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#13402 closed (invalid)

'cycle' template tag can't handle mix of single, double quotes

Reported by: anonymous Owned by: nobody
Component: Template system Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In a template, this:

	{% cycle '<div class="row">', '', '' %}

produces this:

TemplateSyntaxError at /path/to-url/
Could not parse the remainder: '<div class='row'>""' from '""<div class='row'>""'

So does the reverse (encapsulating single quotes within double quotes). Triple-quoted strings also do not work.

Change History (4)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Russell Keith-Magee, 15 years ago

Component: UncategorizedTemplate system

comment:3 by Chris Beaven, 15 years ago

Resolution: invalid
Status: newclosed

You're incorrectly using the old format - don't use commas (see http://docs.djangoproject.com/en/1.1/ref/templates/builtins/#cycle)

comment:4 by Chris Beaven, 15 years ago

Oh, and some proof:

In [1]: from django.template import *

In [2]: t = Template('''{% cycle '<a href="test">' '<a href="test2">' %}''')

In [3]: t.render(Context())
Out[3]: u'<a href="test">'
Note: See TracTickets for help on using tickets.
Back to Top