Code

Opened 4 years ago

Closed 3 years ago

Last modified 3 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:

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 smoluf 4 years ago.
Same patch, but with some nitpicky style changes

Download all attachments as: .zip

Change History (9)

comment:1 Changed 4 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 4 years ago by russellm

See also #12069

comment:3 Changed 4 years ago by smoluf

  • Owner changed from nobody to smoluf

Changed 4 years ago by smoluf

Same patch, but with some nitpicky style changes

comment:4 Changed 4 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 4 years ago by SmileyChris

Alternatively, would be fixed by my patch in #12945

comment:6 Changed 4 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 3 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 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.