Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#446 closed defect (fixed)

[patch] bug in yesno filter prevents usage of 2-value form

Reported by: hugo <gb@…> Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using the yesno filter with only 2 values, it does the decomposition wrong and will set yes to a list instead of a value. this patch fixes that:

Index: defaultfilters.py
===================================================================
--- defaultfilters.py   (revision 585)
+++ defaultfilters.py   (working copy)
@@ -368,7 +368,8 @@
     try:
         yes, no, maybe = bits
     except ValueError: # unpack list of wrong size (no "maybe" value provided)
-        yes, no, maybe = bits, bits[1], bits[1]
+        yes, no = bits
+       maybe = no
     if value is None:
         return maybe
     if value:

Change History (2)

comment:1 by hugo <gb@…>, 19 years ago

attention: a tab crept in and the "maybe = no" line should be indented one more blank to make sense. Sorry :-/

comment:2 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

Fixed in [589].

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