adding organizationalUnit

Michael Engelhart mengelhart at katahdinsoftware.com
Wed May 14 20:55:09 CEST 2003


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 
> you enter for a top-level or mid-level organizationalUnit?
>
> If have the following single entry setup in my OpenLDAP directory:
>
> dn: o=mycompany.com
> objectclass: top
> objectclass: organization
> o: mycompany.com
>
>
> and then want to add from python-ldap this organizationUnit:
>
> dn: ou=People,o=mycompany.com
> objectclass: top
> objectclass: organizationalunit
> ou: People
>
>
> try:
> 	bind_dn="cn=Directory Manager,o=mycompany.com"
> 	password = "xxxxxxxxx"
> 	l = LDAPWrapper(bind_dn,password)
> 	dnToAddTo = "o=mycompany.com"
> 	modlist = []
> 	modlist.append(('dn','ou=People,o=mycompany.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 
> type'}
>
> Thanks
> Michael
>
> On Wednesday, May 14, 2003, at 02:06  PM, Michael Ströder wrote:
>
>> Are you sure that your entry data in the modlist contains the 
>> attribute used for RDN?
>>
>> Please post the code.
>>
>> Ciao, Michael.
>






More information about the python-ldap mailing list