From: Bjorn O. G. <bjo...@it...> - 2006-01-04 21:54:02
|
Rakotomandimby Mihamina: > Hi, > Following > http://www.grotan.com/ldap/python-ldap-samples.html#add >=20 > I made this: >=20 > ############################################# > import ldap > import ldap.modlist as modlist > moi=3D"cn=3DManager,dc=3Dlocaldomain" > l =3D ldap.initialize("ldap://localhost:389/") > l.simple_bind_s(moi,"mypassword") > attrs=3D{} > attrs['objectclass'] =3D > ['top','organizationalRole','simpleSecurityObject'] > attrs['cn'] =3D 'user1' > attrs['userPassword'] =3D 'user1user1' > attrs['description'] =3D 'User object for replication using slurpd' > ldif =3D modlist.addModlist(attrs) > dn=3D"cn=3Duser1,dc=3Dlocaldomain" Do you even have the parent entry in your database? e.g this ldif-representation: # Top root node in your D.I.T dn: dc=3Dlocaldomain objectClass: top objectClass: dcObject dc: localdomain if not, try add it with ldapadd or slapadd from commandline first. I find it very handy to try making shure I'm able to do the most basic things with commandline tools if I get any errors that don't make sence to me using the ldap-api directly. Its a good excersize to play around with ldapadd and ldapmodify working with plain old ldif-files on commandline to get the grips of how LDAP works. > l.add_s(dn,ldif) > ############################################# >=20 > Ans I get this error: >=20 > In [31]: l.add_s(dn,ldif) > -----------------------------------------------------------------------= ---- > ldap.NO_SUCH_OBJECT Traceback (most recent > call last) --=20 regards =20 Bj=F8rn Ove Gr=F8tan |