misc: update ranked items csv value for py3 (#36515)

This commit is contained in:
Frédéric Péters 2019-11-16 16:50:07 +01:00
parent b48283f626
commit a55daeec35
1 changed files with 3 additions and 3 deletions

View File

@ -2299,9 +2299,9 @@ class RankedItemsField(WidgetField):
return ['']
if type(value) is not dict:
value = {}
items = value.items()
items.sort(lambda x,y: cmp(x[1], y[1]))
ranked = [x[0] for x in items if x[1] is not None]
items = [x for x in value.items() if x[1] is not None]
items.sort(key=lambda x: x[1])
ranked = [x[0] for x in items]
return ranked + ['' for x in range(len(self.items)-len(ranked))]