Adding objectClass to existing dn

Michael Ströder michael at stroeder.com
Tue Feb 1 19:05:24 CET 2005


Mark Roach wrote:
> 
>>{'info': "attribute 'cn' not allowed", 'desc': 'Object class violation'}
>>{'info': 'modify/add: objectClass: value #0 already exists', 'desc':
>>'Type or value exists'}
 >
> mlist = ldap.modlist.modifyModlist(attrs, newattrs)

ldap.modlist.modifyModlist() is a function which calculates the delta of 
an old entry and what a new entry should like. The result is a list to 
be passed to LDAPObject.modify() and .modify_s(). Using this function 
would certainly help with the problem the original poster has since it 
would supress adding the same attribute value twice.

But use this function with care! There surely are situations where the 
dumb case-sensitive string match for generating the delta is not 
sufficient. Therefore I don't recommend it unless you're really know 
what you're doing. Better you have full control of what you're doing.

Ciao, Michael.



More information about the python-ldap mailing list