python-ldap article

Michael Ströder michael at stroeder.com
Fri Jun 20 20:44:57 CEST 2003


Ryan,

thanks for contributing docs. Sorry, for reviewing it so late.

ryan wrote:
> 
> I wrote an article on using python-ldap and i'm hoping an expert can look it
> [..]
> http://www.seekrut.com/rk/LDAP-Programming-in-Python.html

1. I'd like to note that there's no such thing like a user in LDAP. A 
bind-DN is normally used with a simple BindRequest which can be the DN of 
any entry in the directory. I'd prefer to see the terms 'who' and 'cred' 
being used instead of 'username' and 'password'.

2. Any reason why you start with showing use of async search() instead of 
the simpler approach for beginners with search_s()?

3. It might be worth to note that an attribute has to be present to retrieve 
e.g. name = entry[1]['cn'][0]. It will throw a KeyError if attribute 'cn' is 
not present in entry. Maybe you can add some simple error handling?

4. I'd like to see a more clearer note about exception being exception 
instances. Something like:

     except ldap.LDAPError, ldap_error:
         print str(ldap_error)

Please go ahead writing more text. Would be very nice to see a python-ldap 
tutorial.

Ciao, Michael.






More information about the python-ldap mailing list