Opened 17 years ago
Last modified 12 years ago
#6271 closed
filter arguments with spaces break several template tags — at Version 1
Reported by: | 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 )
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 , 17 years ago
Attachment: | regroup_regression_test.diff added |
---|
comment:1 by , 17 years ago
Description: | modified (diff) |
---|---|
Has patch: | set |
Patch needs improvement: | set |
Summary: | Changeset 6956 broke regroup tag if filter contains a space → filter arguments with spaces break several template tags |
Triage Stage: | Unreviewed → Accepted |
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 , 17 years ago
by , 17 years ago
Attachment: | smart_split.diff added |
---|
A rewrite of smart_split generator to properly handle quoted phrases like we need
A test case for regroup with filters containing a space