|
From: Rakotomandimby M. <mih...@et...> - 2006-01-04 18:58:17
|
Hi, Following http://www.grotan.com/ldap/python-ldap-samples.html#add I made this: ############################################# import ldap import ldap.modlist as modlist moi="cn=Manager,dc=localdomain" l = ldap.initialize("ldap://localhost:389/") l.simple_bind_s(moi,"mypassword") attrs={} attrs['objectclass'] = ['top','organizationalRole','simpleSecurityObject'] attrs['cn'] = 'user1' attrs['userPassword'] = 'user1user1' attrs['description'] = 'User object for replication using slurpd' ldif = modlist.addModlist(attrs) dn="cn=user1,dc=localdomain" l.add_s(dn,ldif) ############################################# Ans I get this error: In [31]: l.add_s(dn,ldif) --------------------------------------------------------------------------- ldap.NO_SUCH_OBJECT Traceback (most recent call last) /home/mihamina/programmation/ldap/<console> /usr/lib/python2.4/site-packages/ldap/ldapobject.py in add_s(self, dn, modlist) 161 def add_s(self,dn,modlist): 162 msgid = self.add(dn,modlist) --> 163 self.result(msgid,all=1,timeout=self.timeout) 164 165 def simple_bind(self,who='',cred='',serverctrls=None,clientctrls=None): /usr/lib/python2.4/site-packages/ldap/ldapobject.py in result(self, msgid, all, timeout) 397 polling (timeout = 0), in which case (None, None) is returned. 398 """ --> 399 res_type,res_data,res_msgid = self.result2(msgid,all,timeout) 400 return res_type,res_data 401 /usr/lib/python2.4/site-packages/ldap/ldapobject.py in result2(self, msgid, all, timeout) 403 if timeout is None: 404 timeout = self.timeout --> 405 return self._ldap_call(self._l.result2,msgid,all,timeout) 406 407 def search_ext(self,base,scope,filterstr='(objectClass=*)',attrlist=None,attrsonly=0,serverctrls=None,clientctrls=None,timeout=-1,sizelimit=0): /usr/lib/python2.4/site-packages/ldap/ldapobject.py in _ldap_call(self, func, *args, **kwargs) 92 try: 93 try: ---> 94 result = func(*args,**kwargs) 95 finally: 96 self._ldap_object_lock.release() NO_SUCH_OBJECT: {'info': '', 'desc': 'No such object'} -- A powerfull GroupWare, CMS, CRM, ECM: CPS (Open Source & GPL). Opengroupware, SPIP, Plone, PhpBB, JetSpeed... are good: CPS is better. http://www.cps-project.org for downloads & documentation. Free hosting of CPS groupware: http://www.objectis.org. |