Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#12068 closed (fixed)

The {% url %} parser can fail with StopIteration

Reported by: emulbreh Owned by: smoluf
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:


>>> Template("{% url view as %}")
  File "/django/template/", line 1122, in url
    asvar =

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

Attachments (1)

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

Download all attachments as: .zip

Change History (9)

comment:1 Changed 6 years ago by russellm

  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by russellm

See also #12069

comment:3 Changed 6 years ago by smoluf

  • Owner changed from nobody to smoluf

Changed 6 years ago by smoluf

Same patch, but with some nitpicky style changes

comment:4 Changed 6 years ago by alexdutton

  • Triage Stage changed from Accepted to Design 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 6 years ago by SmileyChris

Alternatively, would be fixed by my patch in #12945

comment:6 Changed 6 years ago by ubernostrum

  • milestone changed from 1.2 to 1.3

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

comment:7 Changed 5 years ago by lrekucki

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:8 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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