[python-ldap] Modlist with a replace sometimes fails

Michael Ströder michael at stroeder.com
Thu Feb 18 03:30:30 EST 2016

William wrote:
> I noticed that the code for modlist does the following:
> line 111: 
>       if replace_attr_value:
>         modlist.append((ldap.MOD_DELETE,attrtype,None))
>         modlist.append((ldap.MOD_ADD,attrtype,new_value))
> This often fails on certain ldap servers, especially with configuration
> directives as they cannot be removed before the add takes place.

Could you please give more details:
- LDAP server vendor and exact version
- attribute for which this fails

> I would like to ask that either this be fixed to:
> line 111: 
>       if replace_attr_value:
>         modlist.append((ldap.MOD_REPLACE,attrtype,new_value))

It's probably time to add that to the FAQ:


Note that you don't have to use ldap.modlist.modifyModlist() and your
application can generate your own modlist when tweaking special attributes.

Ciao, Michael.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20160218/acfa7655/attachment.bin>

More information about the python-ldap mailing list