Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#385 closed defect (fixed)

[patch] yesno filter is broken: doesn't accept 2-value argument

Reported by: eugene@… Owned by: Adrian Holovaty
Component: Template system Version:
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


yesno filter throws exception, when it is used with 2-value argument:

{{ mylist|length_is:"1"|yesno:"datum,data" }}

This path works for me:

--- C:\Documents and Settings\Eugene\Local Settings\Temp\	Sun Aug 21 08:34:15 2005
+++ c:\Projects\Django\django\core\	Sun Aug 21 08:27:28 2005
@@ -367,7 +367,7 @@
         yes, no, maybe = bits
     except ValueError: # unpack list of wrong size (no "maybe" value provided)
-        yes, no, maybe = bits, bits[1]
+        yes, no, maybe = bits[0], bits[1], bits[1]
     if value is None:
         return maybe
     if value:

PS: Is there any simple way to pluralize non-regular nouns? Something like this would be nice to have:

{{ mylist|pluralize:"datum,data" }}

Change History (3)

comment:1 Changed 13 years ago by eugene@…

Summary: [patch] '''yesno''' filter is broken: doesn't accept 2-value argument[patch] yesno filter is broken: doesn't accept 2-value argument

comment:2 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

Fixed in [582].

comment:3 Changed 12 years ago by Chris Beaven

In regards to the PS about pluralizing non-regular nouns, that has been fixed in [3272].

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