#446 closed defect (fixed)
[patch] bug in yesno filter prevents usage of 2-value form
Reported by: | 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:
Note:
See TracTickets
for help on using tickets.
attention: a tab crept in and the "maybe = no" line should be indented one more blank to make sense. Sorry :-/