def DelTree(l, dn, scope=ldap.SCOPE_ONELEVEL):
 leafs_deleter = DeleteLeafs(l)
 leafs_deleter.startSearch(dn, scope)
 leafs_deleter.processResults()
 deleted_entries = leafs_deleter.deletedEntries
 non_leaf_entries = leafs_deleter.nonLeafEntries[:]
 while non_leaf_entries:
  dn = non_leaf_entries.pop()
  print deleted_entries, len(non_leaf_entries), dn
  leafs_deleter.startSearch(dn, ldap.SCOPE_SUBTREE)
  leafs_deleter.processResults()
  deleted_entries = (deleted_entries + leafs_deleter.deletedEntries)
  non_leaf_entries.extend(leafs_deleter.nonLeafEntries)
 return

def DelTree ( l , dn , scope = ldap . SCOPE_ONELEVEL ) : leafs_deleter = DeleteLeafs ( l ) leafs_deleter . startSearch ( dn , scope ) leafs_deleter . processResults ( ) deleted_entries = leafs_deleter . deletedEntries non_leaf_entries = leafs_deleter . nonLeafEntries [ : ] while non_leaf_entries : dn = non_leaf_entries . pop ( ) print deleted_entries , len ( non_leaf_entries ) , dn leafs_deleter . startSearch ( dn , ldap . SCOPE_SUBTREE ) leafs_deleter . processResults ( ) deleted_entries = ( deleted_entries + leafs_deleter . deletedEntries ) non_leaf_entries . extend ( leafs_deleter . nonLeafEntries ) return
recursively delete entries below or including entry with name dn .