[PATCH] modlist.py: Compare old and new values

Michael Ströder michael at stroeder.com
Wed Sep 13 10:20:26 CEST 2006

Bhuvaneswaran Arumugam wrote:
> BUG:
> Currently you compare the length of old and new values.

Judging from your patch you mean the attribute value lists.

> So, it does not
> recognize the diff when there is no change in length but the actual
> string itself is changed (ex: s/usr/var/g).

It's not that easy. replace_attr_value can also be set to 1 after line
87. Could you please post an example of the error?

Best thing would be to add your errornous case as test-case to

> Due to this bug, it returns
> empty ldif so subsequent call to modify_s (in my application) fails.

Hmm, are you using module ldif afterwards to turn the modlist into LDIF?
How does the modlist look like. Is it empty?

> <       replace_attr_value = len(old_value)!=len(new_value)
> ---
>>      replace_attr_value = old_value!=new_value

Please note that old_value and new_value are actually lists of attribute
values. This line above sets only a first indicator that an attribute
has changed to avoid performance loss due to calling the function

Ciao, Michael.

More information about the python-ldap mailing list