Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12072 closed (fixed)

Literal strings containing [,=] break {% url %}.

Reported by: Johannes Dollinger Owned by: alexdutton
Component: Template system Version: 1.1
Severity: Keywords: url tag
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

>>> Template('{% url view arg|join:"," %}')
...
TemplateSyntaxError: join requires 1 arguments, 0 provided
>>> Template('{% url view "==" %}')
...
TemplateSyntaxError: Could not parse the remainder: '="' from '="'

Attachments (4)

patch-12072.diff (5.5 KB ) - added by alexdutton 15 years ago.
Patch (maybe not pretty)
patch-12072-c.diff (4.1 KB ) - added by alexdutton 15 years ago.
Tidier patch
patch-12072-d.diff (4.1 KB ) - added by alexdutton 15 years ago.
Tidied up regex
patch-12072-e.diff (4.0 KB ) - added by alexdutton 15 years ago.
Tidied up the regex even more

Download all attachments as: .zip

Change History (13)

comment:1 by anonymous, 15 years ago

Component: UncategorizedTemplate system
Keywords: url tag added

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

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:3 by eculver, 15 years ago

Owner: changed from nobody to eculver
Status: newassigned

comment:4 by eculver, 15 years ago

Owner: changed from eculver to nobody
Status: assignednew

comment:5 by alexdutton, 15 years ago

Owner: changed from nobody to alexdutton

by alexdutton, 15 years ago

Attachment: patch-12072.diff added

Patch (maybe not pretty)

comment:6 by alexdutton, 15 years ago

I've added some tests to highlight the issue, and also replaced the {% url %} argument parsing.

Previously it split on ',' and '=' regardless of whether they're in string literals.

Now using filter_re from django.template to cope with string literals.

by alexdutton, 15 years ago

Attachment: patch-12072-c.diff added

Tidier patch

comment:7 by alexdutton, 15 years ago

New (considerably shorter) patch, with much regex help from Honza.

by alexdutton, 15 years ago

Attachment: patch-12072-d.diff added

Tidied up regex

by alexdutton, 15 years ago

Attachment: patch-12072-e.diff added

Tidied up the regex even more

comment:8 by jbronn, 15 years ago

Resolution: fixed
Status: newclosed

(In [12503]) Fixed #12072 -- Certain characters no longer break url tag. Thanks, Alexander Dutton.

comment:9 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top