Use sort(key=...) to sort widget options.
The decorate/undecorate pattern is no longer necessary and can cause comparision errors in Python 3 (e.g. comparing distinct types).
This commit is contained in:
parent
0e9b73be39
commit
cb788a75c8
|
@ -404,11 +404,10 @@ class SelectWidget(Widget):
|
|||
def make_sort_key(option):
|
||||
value, description, key = option
|
||||
if value is None:
|
||||
return ('', option)
|
||||
return ''
|
||||
else:
|
||||
return (stringify(description).lower(), option)
|
||||
doptions = sorted(map(make_sort_key, options))
|
||||
options = [item[1] for item in doptions]
|
||||
return stringify(description).lower()
|
||||
options.sort(key=make_sort_key)
|
||||
self.options = options
|
||||
|
||||
def _parse_single_selection(self, parsed_key, default=None):
|
||||
|
|
Loading…
Reference in New Issue