Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#12965 closed (fixed)

unordered_list template filter fails when given a non-iterable second item in a two item list

Reported by: Graham Ullrich Owned by: nobody
Component: Template system Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Attachments (1)

unordered_list.diff (1.5 KB ) - added by Graham Ullrich 14 years ago.

Download all attachments as: .zip

Change History (4)

by Graham Ullrich, 14 years ago

Attachment: unordered_list.diff added

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedReady for checkin

comment:2 by Luke Plant, 14 years ago

Resolution: fixed
Status: newclosed

(In [13845]) Fixed #12965 - unordered_list template filter fails when given a non-iterable second item in a two item list

Thanks to grahamu for the report and patch.

comment:3 by Luke Plant, 14 years ago

(In [13846]) [1.2.X] Fixed #12965 - unordered_list template filter fails when given a non-iterable second item in a two item list

Thanks to grahamu for the report and patch.

Backport of [13845] from trunk

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