Opened 17 years ago

Closed 17 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: dev
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: no UI/UX: no

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@… 17 years ago.
Patch to defaulttags and test

Download all attachments as: .zip

Change History (3)

by scott@…, 17 years ago

Attachment: url-tag-spaces.diff added

Patch to defaulttags and test

comment:1 by Chris Beaven, 17 years ago

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 by Malcolm Tredinnick, 17 years ago

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