What's the best way to replace value of attribute which can handle multiple values?
Zhang Huangbin
zhbmaillistonly at gmail.com
Wed Sep 9 07:32:44 CEST 2009
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/
More information about the python-ldap
mailing list