Code

Opened 9 years ago

Closed 9 years ago

Last modified 8 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:

Attachments (0)

Change History (2)

comment:1 Changed 9 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 9 years ago by adrian

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

Fixed in [589].

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.