Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#27866 closed Cleanup/optimization (fixed)

Make ChoiceWidget.format_value() return a list

Reported by: Claude Paroz Owned by: nobody
Component: Forms Version: 1.11
Severity: Normal 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

Currently, ChoiceWidget.format_value returns a set. I have a use case with a custom widget where selected value ordering matters. I can subclass format_value in my widget subclass, but I wonder if the transformation to a set, losing value ordering, is there on purpose. It seems the test suite does not fail when keeping a list. I'll suggest a patch.

Change History (9)

comment:2 by Tim Graham, 7 years ago

Summary: Make ChoiceWidget.format_value return a listMake ChoiceWidget.format_value() return a list
Triage Stage: UnreviewedAccepted
Version: master1.11

That method is new in 1.11 for template-based widget rendering (b52c73008a9d67e9ddbb841872dc15cdd3d6ee01) so I think the change should be backported, probably without the force_text(v) removal. How about tests for the method?

comment:3 by Claude Paroz, 7 years ago

The method is new, but the behavior with the set() is not new. We could backport, but that's not mandatory.

comment:4 by Tim Graham, 7 years ago

Needs tests: set

comment:5 by Claude Paroz, 7 years ago

Needs tests: unset

comment:6 by Tim Graham, 7 years ago

Triage Stage: AcceptedReady for checkin

comment:7 by Claude Paroz <claude@…>, 7 years ago

Resolution: fixed
Status: newclosed

In e487ffd:

Fixed #27866 -- Made ChoiceWidget.format_value() return a list

Thanks Tim Graham for the review.

comment:8 by Claude Paroz <claude@…>, 7 years ago

In 06d32f68:

[1.11.x] Fixed #27866 -- Made ChoiceWidget.format_value() return a list

Thanks Tim Graham for the review.
Backport of e487ffd3f0f9931e7c18bfbd47cf1e6b059ddc41 from master.

comment:9 by Claude Paroz <claude@…>, 7 years ago

In 523a803:

[1.11.x] Refs #27866 -- Adapted backport for Python 2 compatibility

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