summaryrefslogtreecommitdiffstats
path: root/ipaserver/ipaldap.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-01-21 07:03:33 -0500
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:44 +0100
commitb69f6983e4bb01e2af63c4b02a0ab79b24e59569 (patch)
treea3c3c69a55b2b82bb1a536a7b527cbe0169f0561 /ipaserver/ipaldap.py
parent607ff478f55e330ab68744beb699dc96d6a5f94a (diff)
downloadfreeipa.git-b69f6983e4bb01e2af63c4b02a0ab79b24e59569.tar.gz
freeipa.git-b69f6983e4bb01e2af63c4b02a0ab79b24e59569.tar.xz
freeipa.git-b69f6983e4bb01e2af63c4b02a0ab79b24e59569.zip
Remove IPAdmin.get_dns_sorted_by_length
A simple sort(key=len) is simpler both implementation-wise and semantics-wise. Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
Diffstat (limited to 'ipaserver/ipaldap.py')
-rw-r--r--ipaserver/ipaldap.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index a84f8fac..7253bc1f 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -1794,42 +1794,6 @@ class IPAdmin(LDAPConnection):
else: break
return (done, exitCode)
- def get_dns_sorted_by_length(self, entries, reverse=False):
- """
- Sorts a list of entries [(dn, entry_attrs)] based on their DN.
- Entries within the same node are not sorted in any meaningful way.
- If Reverse is set to True, leaf entries are returned first. This is
- useful to perform recursive deletes where you need to delete entries
- starting from the leafs and go up to delete nodes only when all its
- leafs are removed.
-
- Returns a list of list of dn's. Every dn in the dn list has
- the same number of RDN's. The outer list is sorted according
- to the number of RDN's in each inner list.
-
- Example:
-
- [['cn=bob', cn=tom], ['cn=bob,ou=people', cn=tom,ou=people]]
-
- dn's in list[0] have 1 RDN
- dn's in list[1] have 2 RDN's
- """
-
- res = dict()
-
- for e in entries:
- dn = e.dn
- assert isinstance(dn, DN)
- rdn_count = len(dn)
- rdn_count_list = res.setdefault(rdn_count, [])
- if dn not in rdn_count_list:
- rdn_count_list.append(dn)
-
- keys = res.keys()
- keys.sort(reverse=reverse)
-
- return map(res.get, keys)
-
def __getattr__(self, attrname):
# This makes IPAdmin classes look like IPASimpleLDAPObjects
# FIXME: for backwards compatibility only