Opened 18 years ago

Closed 18 years ago

#1597 closed defect (worksforme)

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

Reported by: pete@… 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 Adrian Holovaty, 18 years ago

Resolution: invalid
Status: newclosed

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

comment:2 by Chris Beaven, 18 years ago

Resolution: invalid
Status: closedreopened

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 Adrian Holovaty, 18 years ago

Resolution: worksforme
Status: reopenedclosed

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

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