ldap.set_option() ready

Jacek Konieczny jajcus at bnet.pl
Tue Nov 13 13:29:39 CET 2001


On Tue, Nov 13, 2001 at 10:13:54PM +1000, David Leonard wrote:
> On Tue, 13 Nov 2001, Jacek Konieczny typed thusly:
> 
> > The two interfaces can coexist.
> 
> um, i'd like to avoid too many ways of doing the same thing.. it leads to
> confusion... so, just one way or the other thanks :)

In this case IMHO set_option() seems more reasonable. But it will break
backward compatibility (for those options which are already implemented
as attributes).
Using attributes of LDAPObject for connection-specific options and
set_object() function for global/default options will make mess like
this:


import ldap
ldap.set_option(ldap.OPT_SIZELIMIT,100)   # sets default size limit
l=ldap.initialize("ldap://localhost/")
l.sizelimit=100                           # sets size limit for connection l

As you see the same option is set in two totally different ways. I the 
C API both are set using the same function with only difference is that,
in the first case first argument (LDAP object) is NULL.

I won't touch __setattr__() and set_option() of LDAPObject until we
decide on some solution.
 
I personally still think that the two (attribute, set_option()) solution
can coexist, provided they share as much code as possible.

Greets,
        Jacek




More information about the python-ldap mailing list