From: Michael E. <men...@ka...> - 2003-05-14 18:55:46
|
BTW, the LDAPWrapper is just simple wrapper class that I wrote. The add method looks like this: def add(self, dn, modlist): # synchronous add try: self.server.add_s(dn, modlist) except ldap.LDAPError, e: raise On Wednesday, May 14, 2003, at 02:20 PM, Michael Engelhart wrote: > No, I'm not sure. :-) > I guess my misunderstanding is that add() requests a dn. What dn do=20= > you enter for a top-level or mid-level organizationalUnit? > > If have the following single entry setup in my OpenLDAP directory: > > dn: o=3Dmycompany.com > objectclass: top > objectclass: organization > o: mycompany.com > > > and then want to add from python-ldap this organizationUnit: > > dn: ou=3DPeople,o=3Dmycompany.com > objectclass: top > objectclass: organizationalunit > ou: People > > > try: > bind_dn=3D"cn=3DDirectory Manager,o=3Dmycompany.com" > password =3D "xxxxxxxxx" > l =3D LDAPWrapper(bind_dn,password) > dnToAddTo =3D "o=3Dmycompany.com" > modlist =3D [] > modlist.append(('dn','ou=3DPeople,o=3Dmycompany.com')) > modlist.append(('objectclass',['top','organizationalunit'])) > modlist.append(('ou','People')) > l.add(dnToAddTo, modlist) > l.close() > except ldap.LDAPError, e: > print e > > I get this error: > {'info': 'dn: attribute type undefined', 'desc': 'Undefined attribute=20= > type'} > > Thanks > Michael > > On Wednesday, May 14, 2003, at 02:06 PM, Michael Str=F6der wrote: > >> Are you sure that your entry data in the modlist contains the=20 >> attribute used for RDN? >> >> Please post the code. >> >> Ciao, Michael. > |