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

Michael Ströder michael at stroeder.com
Wed Sep 9 15:58:26 CEST 2009


Zhang Huangbin wrote:
> 
> On Sep 9, 2009, at 9:48 PM, Michael Ströder wrote:
> 
>> BTW: That's why
>> ldap.modlist.modifyModlist() was implemented.
> 
> Any example?
> 
> There is no example in official python-ldap document:
> http://www.python-ldap.org/doc/html/ldap-modlist.html?highlight=modifymodlist#ldap.modlist.modifyModlist

>>> import ldap.modlist
>>> ldap.modlist.modifyModlist({'cn':'Mike'},{'cn':'Michael
Stroeder','mail':'michael at stroeder.com'})
[(0, 'mail', 'michael at stroeder.com'), (1, 'cn', None), (0, 'cn', 'Michael
Stroeder')]

So basically you read the old_entry dict with an search operation, derive a
new_entry dict from it, tweak that and pass old_entry and new_entry to this
function.

Ciao, Michael.



More information about the python-ldap mailing list