Question in LDAPEntry.set()

Federico Di Gregorio fog at
Mon Apr 2 00:41:15 CEST 2001

Scavenging the mail folder uncovered Jean-Eric Cuendet's letter:

> But I can't modify them.
> I'm unable to use the LDAPEntry.set() method.
> Could someone explain me what means:
>   def set(self, key, *values):
> The star (*) before "values" ?
> What should be the type of this parameter? And the value?

in ldap you can have the same field/attribute repeated more that once. 
if you give .set() a list, it will generate multiple attributes with
the same name but different values, e.g., 

	entry.set('cn', ['Federico', 'fog])

note that you are using my first try at a high level python interface.
after some comments on this list i begun to slowly rewrite this api
following the java-ldap api. so, you are using something that will go
away in the future...

Scavenging the mail folder uncovered Jean-Eric Cuendet's letter:
> Just another thing:
> When I run my program (attached), I have the following error:
> Begin changing
> Traceback (most recent call last):
>   File "./", line 79, in ?
>     res.set("gecos", list);
>   File "/usr/lib/python2.0/site-packages/python-ldap/ldap/", line
> 133, in set
>[key] = ([key][0]+values, 1)
> TypeError: can only concatenate list (not "tuple") to list 

you gave it a tuple, .set() only accept lists.


Federico Di Gregorio
MIXAD LIVE Chief of Research & Technology              fog at
Debian GNU/Linux Developer & Italian Press Contact        fog at
                             Best friends are often failed lovers. -- Me

More information about the python-ldap mailing list