changing 'cn'

Michael Ströder michael at stroeder.com
Tue Dec 5 20:54:38 CET 2006


Anil wrote:
> If I have an entry like this:
> 
> dn: cn=unique-abc, ou=people, o=isp
> objectclass: top
> ...
> cn: unique-abc
> cn: hello
> [..]
> How do I go about changing 'hello' to 'world' using modify() (or some 
> other method)?
> 
> It seems there are only ADD/DEL/REPLACE operations, which don't work in 
> this environment. Is it possible to pass a modlist that replaces only 
> the hello instead of replacing everything?
> 
> (basically, I want to keep the RDN intact, instead just be able to make 
> changes to non RDN values)

In this case, since 'cn' is of syntax DirectoryString for which probably
an equality matching is implemented in your server, you can explicitly
remove 'hello' and add 'world'.

l.modify_s(dn,[('cn',ldap.MOD_DELETE,['hello']),('cn',ldap.MOD_ADD,['world'])])

Ciao, Michael.



More information about the python-ldap mailing list