Opened 8 years ago

Closed 8 years ago

#3543 closed (fixed)

url template tag gives no error if keyword arguments contain spaces

Reported by: scott@… Owned by: adrian
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:

Description

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 country=address.country, city=address.city %} # bad
{% url test.views.check_location country=address.country,city=address.city %} # 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@… 8 years ago.
Patch to defaulttags and test

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by scott@…

Patch to defaulttags and test

comment:1 Changed 8 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready 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 8 years ago by mtredinnick

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

(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