[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ldap-dev
Subject:    Re: how to use modlist?
From:       Wido Depping <wido.depping () gmail ! com>
Date:       2005-01-04 12:41:42
Message-ID: 127079e105010404417ec7ee63 () mail ! gmail ! com
[Download RAW message or body]

On Tue, 04 Jan 2005 16:12:12 +0700, tnd@it.fts-vn.com <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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic