Comment 1 for bug 557675

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.