[python-ldap] Bug in ldap.modlist.modifyModlist

Michael Ströder michael at stroeder.com
Tue Oct 20 14:20:36 EDT 2015


Thierry Lam Yan On wrote:
> For the following code in version 2.4.21:
> 
> import ldap
> 
> import ldap.modlist
> 
> old_values = {
>     'department': 'Blue Sky',
> }
> 
> new_values = {
>     'department': 'Sky Blue',
> }
> 
> mods = ldap.modlist.modifyModlist(old_values, new_values)
> 
> print mods

> 
> The above returns:
> []
> 
> The comparison method cannot detect for the same set of words in different order.

Rephrase: Set of chars. ;-]

Note that entry dicts must have *list* of attribute values for each attribute:

>>> old_values = {
... 'department': ['Blue Sky'],
... }
>>>
>>> new_values = {
... 'department': ['Sky Blue'],
... }
>>>
>>> mods = ldap.modlist.modifyModlist(old_values, new_values)
>>> mods
[(1, 'department', None), (0, 'department', ['Sky Blue'])]

Ciao, Michael.

P.S.:
Please subscribe to the low-traffic mailing list. Otherwise I have to manually
approve your posting and you might miss responses only going to the list.


-------------- 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/20151020/24487218/attachment.bin>


More information about the python-ldap mailing list