modifying problem

Michael Ströder michael at
Sat Dec 1 14:26:24 CET 2007

Anil Jangity wrote:
> Okay, I was just introduced to "multi-valued RDN", didn't know about that.

Because of this + is also a special char in DNs. Always use
ldap.dn.escape_dn_chars() to escape special chars in attribute values
before forming a DN string.

> So, here's a quick question. Is there a easy way/code to modify these
> kinds of RDN? Its a little bit of extra work to have to go figure out
> that a RDN is being changed and then go use modrdn.

Well, you have to check yourself whether an attribute is part of the RDN
and then use method rename/rename_s() to do the necessary changes. Note
that delold=1 makes it remove the old attribute values. BTW: Today
modrdn/modrdn_s() is just a wrapper method around rename().

ldap.dn.explode_rdn() or even better ldap.dn.str2dn() might be handy to
decompose (R)DN strings.

Ciao, Michael.

More information about the python-ldap mailing list