From: Lukas M. <lu...@ms...> - 2003-11-28 08:22:59
|
Hi there, I want to show the whole ldap structure in a tree. I want to do that with a loop that continous searching in each branch it found. But my problem is, how I can let the loop know if it is the end btw the last branch of a branch. Is there anything to check for that? My current code checks everytime the first branch, then the first branch of the first branch etc. but if it is at the latest one, it hangs. So I need anything how i can say "if you are in the latest one, break the loop". Below is a code snip of this loop: basedn = dn for name, attrs in l.search_s(dn, ldap.SCOPE_ONELEVEL, "objectclass=*", []): print name newdn = name while 1: for name, attrs in l.search_s(newdn, ldap.SCOPE_ONELEVEL, "objectclass=*"): newdn = name print newdn break Does anyone know a solution to this problem? Best regards Lukas |