This code snippet shows a simple function that will modify attributes of an object using LDAP and python-ldap. Parameters: handle = a connection handle as returned by __connect dn = string representation of the DN of the object to be modified attrs = list of tuples that specify the changes to be made. Each tuple contains three values:
So, a valid value for attrs: [ (ldap.MOD_ADD, "instantMessagingID", "babybumkins") ].
See python-ldap documentation for more details.
import ldap
def __modify( handle, dn, attrs ):
if not handle:
return False
handle.modify_s( dn, attrs )
© 2009 Novell, Inc. All Rights Reserved.