Opened 10 years ago

Closed 10 years ago

#3543 closed (fixed)

url template tag gives no error if keyword arguments contain spaces

Reported by: scott@… Owned by: Adrian Holovaty
Component: Template system Version: master
Severity: Keywords: url tag urlresolvers space
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I was stuck for a while using the url template tag with keyword arguments. The problem was I had a space after the comma delimiting the arguments, something like:

{% url test.views.check_location, %} # bad
{% url test.views.check_location, %} # good

The space caused MatchChecker to look for a keyword parameter named ' city' (i.e. with leading space). The pattern didn't match, so I got nothing. I think an exception might be more helpful, so here's a patch in case you agree. :)

Attachments (1)

url-tag-spaces.diff (2.9 KB) - added by scott@… 10 years ago.
Patch to defaulttags and test

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by scott@…

Attachment: url-tag-spaces.diff added

Patch to defaulttags and test

comment:1 Changed 10 years ago by Chris Beaven

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedReady for checkin

Thanks Scott.

Personally I'd prefer it if the arguments weren't comma separated but rather space separated (like most other tags we have), but that's a different issue altogether ;)

comment:2 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [5077]) Fixed #3543 -- Be a bit more tolerant of spaces following the comma
argument separator in the "url" tag.

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