Hi, all.

What's the best way to 'replace' value of attribute which can handle  
multiple values?

Such as:

dn: uid=myuid,dc=example,dc=com
cn: cn1
cn: cn2
cn: cn3

My purpose is to get ldif like this (no cn=cn2 any more):

dn: uid=myuid,dc=example,dc=com
cn: cn1
cn: cn3
cn: cn4

I want to replace cn=cn2 by cn=cn4 if it exist, or add cn=cn4 directly  
if 'cn=cn2' donesn't exist.

If cn=cn2 is not exist, [(ldap.MOD_DELETE, 'cn', 'cn2')] will raise an  
error.
If cn=cn2 is not exist, [(ldap.MOD_ADD, 'cn', 'cn4')] will add cn=cn4,  
but can't delete 'cn=cn2'.

Thanks very much. :)

-- 
Best Regards.

Zhang Huangbin

- Open Source Mail Server Solution for Red Hat(R) Enterprise Linux,
   CentOS, Debian, Ubuntu: http://www.iredmail.org/


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev

Reply via email to