how to know the end?

Michael Ströder michael at stroeder.com
Fri Nov 28 16:14:37 CET 2003


paul kölle wrote:
> Lukas Meyer wrote:
> 
>> 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".
> 
> Just a thought, at least Openldap each entry has an operational 
> attribute "hasSubordinates: TRUE | FALSE".

This works on e.g. OpenLDAP (since 2.1.5?) and on some X.500 servers and 
it's the most generic attribut for determining a leaf entry. One can also 
evaluate integer value of attribute 'subordinateCount' on Novell eDirectory 
or 'numSubordinates' on Netscape/iPlanet/SunONE Directory Server. Note that 
the latter is not usable on iPlanet/SunONE Directory Server 5.x+ without 
adding a-priori knowledge to the application that the attribute 
'numSubordinates' should be there if it's a non-lead entry.

web2ldap contains code for this when searching and doing recursive deletes. 
It also falls back to doing a one-level search when none of the attributes 
above is present.

Ciao, Michael.



More information about the python-ldap mailing list