Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#12068 closed (fixed)

The {% url %} parser can fail with StopIteration

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

Description

>>> Template("{% url view as %}")
...
  File "/django/template/defaulttags.py", line 1122, in url
    asvar = bits.next()
StopIteration

This should either work (variables may be named as) or fail with TemplateSyntaxError.

Attachments (1)

12068.diff (3.6 KB) - added by Stefan Moluf 7 years ago.
Same patch, but with some nitpicky style changes

Download all attachments as: .zip

Change History (9)

comment:1 Changed 7 years ago by Russell Keith-Magee

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Russell Keith-Magee

See also #12069

comment:3 Changed 7 years ago by Stefan Moluf

Owner: changed from nobody to Stefan Moluf

Changed 7 years ago by Stefan Moluf

Attachment: 12068.diff added

Same patch, but with some nitpicky style changes

comment:4 Changed 7 years ago by alexdutton

Triage Stage: AcceptedDesign decision needed

We currently disallow {% url view as %}, but accept {{ as }}. Should there be some consistency twixt the two?

Indeed, should any attempt to pass a keyword-named variable into a Context throw some error?

comment:5 Changed 7 years ago by Chris Beaven

Alternatively, would be fixed by my patch in #12945

comment:6 Changed 7 years ago by James Bennett

milestone: 1.21.3

This is enough of an edge case that I'm comfortable punting it from 1.2.

comment:7 Changed 6 years ago by Łukasz Rekucki

Resolution: fixed
Status: newclosed

This is fixed on 1.2.x and trunk, probably for a while now.

comment:8 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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