unordered_list template filter fails when given a non-iterable second item in a two item list
|Reported by:||grahamu||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When unordered_list processes a list with just two items it fails if the second item is not iterable.
Once convert_old_style_list() determines that 'second_item' is not an empty list, it assumes that item is an iterable. That certainly is true for lists, tuples, and strings. However, if the second item is a non-iterable object the code doesn't work. Nothing in the documentation suggests that the unordered_list filter only accepts iterables, so I think this is a bug.
I've attached a patch with an associated test in regressiontests/defaultfilters/tests.py, but am unsure about whether a test is also needed in regressiontests/templates/filters.py.
Change History (4)
Changed 5 years ago by grahamu
comment:1 Changed 5 years ago by russellm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Ready for checkin
comment:2 Changed 5 years ago by lukeplant
- Resolution set to fixed
- Status changed from new to closed