Opened 19 years ago
Closed 19 years ago
#1597 closed defect (worksforme)
Pluralize filter should add the "s" on zero matches.
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | |
Severity: | minor | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The pluralize filter in 0.91 does not add the "s" character when the given object is a sequence with zero items. It should because otherwise the text looks awkward.
Compare the current:
Search found 0 member.
With the expected:
Search found 0 members.
Change History (3)
comment:1 by , 19 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 19 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Actually Adrian, the pluralize filter does also handle sequences. I'll reopen because it's resolution shouldn't be 'invalid'.
But the code works for me (in Python at least):
>>> pluralize(['a', 'b']) 's' >>> pluralize([]) 's' >>> pluralize(['a']) '' >>>
comment:3 by , 19 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
OK, I'll change the resolution to a worksforme, then.
Note:
See TracTickets
for help on using tickets.
You pass
pluralize
a number, not a sequence. In your case, do this:some_sequence|length|pluralize