Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#446 closed defect (fixed)

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

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

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 Changed 10 years ago by hugo <gb@…>

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

comment:2 Changed 10 years ago by adrian

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

Fixed in [589].

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