ObjectGroupedSelectInput is broken

Bug #557675 reported by Forrest Aldridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Methanal
Fix Released
High
Jonathan Jacobs

Bug Description

There are two problems with the ObjectGroupedSelectInput - one minor, one major.

First of all, according to the current design, the ObjectGroupedSelectInput should inherit from GroupedSelectInput instead of SelectInput.

Even when this is fixed however, a bigger problem remains:

The current code for handling the ObjectGroupedSelectInput initialization, _ObjectChoiceMixinBase.__init__(), cannot handle the grouped values case. That is, if the values argument is passed to the __init__ method as [(groupName, [(object, description), ...]), (...), ...] instead of the expected [(object, description), (...), ...], then the input will initialized incorrectly.

Related branches

summary: - ObjectGroupedSelectInput is broken.
+ ObjectGroupedSelectInput is broken
Changed in methanal:
status: New → Triaged
importance: Undecided → High
milestone: none → 0.2.1
Revision history for this message
Jonathan Jacobs (jjacobs) wrote :

Tristan and I spoke about this and we decided that leveraging Enum is possibly the best way forward for this whole Grouped/Object ChoiceInput spaghetti disaster.

The idea for grouping is: ChoiceInput attempts to find an "extra" value on an EnumItem named "group", which is both the unique identifier and group name. In the case no such "extra" value exists, the EnumItem is not grouped.

The idea for objects is: An Enum subclass is defined (ObjectEnum, maybe) that will perform the auto-value-from-object-id function on the "value" parameter of EnumItems.

The win here is that we can squash the problem of having to expand every combination of grouped ChoiceInputs and object ChoiceInputs. Unfortunately defining an Enum is not as simple as dumping a tuples and a lists in your source code, on the other hand it is a lot more descriptive and useful. There is an adapter for list to IEnumeration, so the old style would still work, it just wouldn't be very flexible.

Changed in methanal:
status: Triaged → In Progress
assignee: nobody → Jonathan Jacobs (jjacobs)
Changed in methanal:
status: In Progress → Fix Committed
Changed in methanal:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.