Novell Home

Renaming an object in eDirectory using LDAP and Python

From Developer Community

This code snippet shows a simple function to rename an object's DN in eDirectory using python-ldap. Parameters: handle = connection handle as returned from __connect olddn = string representation of DN we are renaming from newdn = string representation of DN we are renaming to delete_olddn = default is 1, indicates to delete the olddn value if 1

Function

import ldap

def __rename( handle, olddn, newdn, delete_olddn=1 ):
    if not handle:
        return False
    handle.modrdn_s( olddn, newdn, delete_olddn )

--Matt Ryan

Novell® Making IT Work As One

© 2008 Novell, Inc. All Rights Reserved.