From 9ef16f3c6312ed6fbb0a6c8f9357fa5099ab862b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 1 Nov 2011 15:15:42 +0100 Subject: [PATCH] sort persons alphabetically --- tabellio/pfbviews/commission.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tabellio/pfbviews/commission.py b/tabellio/pfbviews/commission.py index 666abca..28616a2 100644 --- a/tabellio/pfbviews/commission.py +++ b/tabellio/pfbviews/commission.py @@ -2,6 +2,8 @@ from Products.Five import BrowserView +from themis.fields.vocabs import cmp_person + class View(BrowserView): def presidence_polgroups(self): return [self.context.president.to_object.polgroup.to_object] @@ -28,19 +30,19 @@ class View(BrowserView): return self.list_polgroups(self.context.vicepresidents) def vicepresidence_members(self, polgroup): - return [x.to_object for x in self.context.vicepresidents - if x.to_object.polgroup.to_object == polgroup] + return sorted([x.to_object for x in self.context.vicepresidents + if x.to_object.polgroup.to_object == polgroup], cmp_person) def members_polgroups(self): return self.list_polgroups(self.context.members) def members_members(self, polgroup): - return [x.to_object for x in self.context.members - if x.to_object.polgroup.to_object == polgroup] + return sorted([x.to_object for x in self.context.members + if x.to_object.polgroup.to_object == polgroup], cmp_person) def substitutes_polgroups(self): return self.list_polgroups(self.context.substitutes) def substitutes_members(self, polgroup): - return [x.to_object for x in self.context.substitutes - if x.to_object.polgroup.to_object == polgroup] + return sorted([x.to_object for x in self.context.substitutes + if x.to_object.polgroup.to_object == polgroup], cmp_person)