Commit 5632564e authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

use sorted(x, key=...) since we shouldn't compare entities

parent 7e3ebfd2b421
......@@ -61,7 +61,7 @@ class Email(TreeMixIn, AnyEntity):
alternatives.append(set(p.eid for p in part.alternative))
alternatives[-1].add(part.eid)
else:
result.append((part.ordernum, part))
result.append(part)
if alternatives:
for altset in alternatives:
selected = [parts_by_eid[peid] for peid in altset
......@@ -70,9 +70,8 @@ class Email(TreeMixIn, AnyEntity):
selected = selected[0]
else:
selected = parts_by_eid[altset.pop()]
result.append((selected.ordernum, selected))
result.sort()
return [p[1] for p in result]
result.append(selected)
return sorted(result, key=lambda x: x.ordernum)
def references(self):
result = set()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment