From 9cac1d88fcffcce65018869827eadcfc0ff157f1 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 13 Apr 2011 10:48:07 -0400 Subject: Sort entries returned by *-find by the primary key (if any). Do a server-side sort if there is a primary key. Fix a couple of tests that were failing due to the new sorting. ticket 794 --- ipalib/plugins/baseldap.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ipalib/plugins/baseldap.py') diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index d516ed67..0dcb8903 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -1418,6 +1418,10 @@ class LDAPSearch(CallbackInterface, crud.Search): else: callback(self, ldap, entries, truncated, *args, **options) + if self.obj.primary_key: + sortfn=lambda x,y: cmp(x[1][self.obj.primary_key.name][0].lower(), y[1][self.obj.primary_key.name][0].lower()) + entries.sort(sortfn) + if not options.get('raw', False): for e in entries: self.obj.convert_attribute_members(e[1], *args, **options) -- cgit