Opened 16 years ago

Last modified 11 years ago

#6271 closed

filter arguments with spaces break several template tags — at Version 1

Reported by: Rob Hudson <treborhudson@…> Owned by: nobody
Component: Template system Version: dev
Severity: Normal Keywords: tplrf-fixed
Cc: serg@…, bmispelon@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Gary Wilson)

After [6956], something like this now breaks:

{% regroup object_list by created|date:"F Y" as grouped %}

I believe it now splits the quoted bits and the arg count is more than 6 in this case, so the templatetag errors out.

Change History (4)

by Rob Hudson <treborhudson@…>, 16 years ago

A test case for regroup with filters containing a space

comment:1 by Gary Wilson, 16 years ago

Description: modified (diff)
Has patch: set
Patch needs improvement: set
Summary: Changeset 6956 broke regroup tag if filter contains a spacefilter arguments with spaces break several template tags
Triage Stage: UnreviewedAccepted

The bigger problem here is that many of the template tags do not accept filtered arguments passed an argument with a space because they are simply doing token.contents.split().

Here is a patch that seems to fix things for regroup, ifchanged, and with. firstof, if, and ifequal/ifnotequal need some more (involved) work. I changed smart_split_re to allow text before and after the quote characters. Not sure if we want smart_split() to basically only be for parsing template tags, but it seems to be the only place it's used currently.

by Gary Wilson, 16 years ago

Attachment: 6271.diff added

by Chris Beaven, 16 years ago

Attachment: smart_split.diff added

A rewrite of smart_split generator to properly handle quoted phrases like we need

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