ldap python, how2?

Vetle Roeim vr at acm.org
Tue Oct 17 05:12:49 EDT 2000


* Jørgen Teunis
> Hello,
> 
> Could anybody tell me where i can find the documentation of the python-ldap
> module?

you'll have to download the source from
<URL:http://python-ldap.sourceforge.net>. the documentation is located
in the Doc subdirectory.


> Where there is clearly explained wich functions there are and how they work.
> I've some trouble with adding persons to the ldap server. I managed to add
> organisationalunits.
> I use this code:
> 
> try:
>  dn = "cn=Jorgen, dc=People, dc=Mailinglist,o=bos,c=nl"
>  print "Updating", repr(dn)
> 
>         l.add_s(dn,
>          [
>             ("cn", ["Jorgen"]),
>             ("givenname", ["Jørgen"]),
>             ("objectclass",["top"]),
>             ("objectclass",["person"]),
>             ("objectclass",["organizationalperson"]),
>             ("Phone", ["065464894"]),
>             ("description", ["Miljonair"])
>          ]
>        )
> 
> except ldap.LDAPError:
>         pass
> 
> l.unbind()
> 
> I get no error's but after i execute it, it isn't inserted........

you don't get an error because you catch the exception. when an error
occurrs in the call to add_s(), an exception which contains the
errormessage is thrown.

try the same code without catching the exception. the errormessage
should then be written to the screen.


vr



More information about the Python-list mailing list