On Tue, 04 Jan 2005 16:12:12 +0700, tnd@it.fts-vn.com wrote: > Sorry for my stupid question but the document on ldap.modlist is not > clear and no example. > I've tried to use function addModlist like below > ldap.modlist.addModlist(['key','value']) > and receive the error > ... > AttributeError: 'list' object has no attribute 'keys' > > Could you give me a small example to use modlist correctly. > Thanks. > > (--ntdt--) addModlist works on the dictionary of an entry which you get for every search result. You get something like this: [('cn=foo,o=bar', {'objectClass': ['top', 'account'], 'uid': ['1028'], 'cn': ['Foo Bar']}), (second result)] Get the data dictionary and use addModlist. See here some sample code from the python console: >>> a = {'objectClass': ['top', 'account'], 'uid': ['1028'], 'cn': ['Foo Bar']} >>> import ldap.modlist >>> ldap.modlist.addModlist(a) [('objectClass', ['top', 'account']), ('uid', ['1028']), ('cn', ['Foo Bar'])] The result is your modlist. I hope this makes verything clear. mfg. Wido -- Wido Depping ICQ: 51303067 AIM: wido3379 Jabber: wido@jabber.ccc.de Blog: http://widoww.blogspot.com ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Python-LDAP-dev mailing list Python-LDAP-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/python-ldap-dev