DBEnumeratedType's default sort_order should follow its items' values
Bug #129192 reported by
Eleanor Berger
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.enum |
Triaged
|
Low
|
Unassigned |
Bug Description
canonical.
The default sort_order for DBEnumeratedType seems to be based on the order of the assignment of the attributes, but in almost all cases we'd expect to sort by the value of the DBItems. As a further complication, it is impossible, due to the way the implementation uses the metaclass protocol, to provide a dynamic implementation of sort_order which inspects the DBItems, since at the time sort_order is called for the first time the class still doesn't provide the iterator over those items.
Changed in launchpad: | |
assignee: | nobody → thumper |
Changed in launchpad-foundations: | |
assignee: | thumper → nobody |
Changed in launchpad-foundations: | |
status: | New → Triaged |
importance: | Undecided → Low |
visibility: | private → public |
affects: | launchpad → lazr.enum |
To post a comment you must log in.
You have three choices here:
1) Re-order the declaration order of the DBItems
2) Add a sort_order member
3) Derive from the schema to change the order if more than one order is needed