summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-04-13 10:48:07 -0400
committerMartin Kosek <mkosek@redhat.com>2011-04-13 17:29:16 +0200
commit9cac1d88fcffcce65018869827eadcfc0ff157f1 (patch)
tree9c99b92a5650b7b2ce435278c388b50a05d71e43 /ipalib
parent1ac3ed2c271accc0776a3cc34fbe607acf62da17 (diff)
downloadfreeipa-9cac1d88fcffcce65018869827eadcfc0ff157f1.tar.gz
freeipa-9cac1d88fcffcce65018869827eadcfc0ff157f1.tar.xz
freeipa-9cac1d88fcffcce65018869827eadcfc0ff157f1.zip
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
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/baseldap.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index d516ed673..0dcb89039 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)