Opened 10 years ago

Closed 10 years ago

#1597 closed defect (worksforme)

Pluralize filter should add the "s" on zero matches.

Reported by: pete@… Owned by: adrian
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: UI/UX:


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 Changed 10 years ago by adrian

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

You pass pluralize a number, not a sequence. In your case, do this: some_sequence|length|pluralize

comment:2 Changed 10 years ago by SmileyChris

  • Resolution invalid deleted
  • Status changed from closed to 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'])
>>> pluralize([])
>>> pluralize(['a'])

comment:3 Changed 10 years ago by adrian

  • Resolution set to worksforme
  • Status changed from reopened to closed

OK, I'll change the resolution to a worksforme, then.

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