ldap.set_option() ready

Jacek Konieczny jajcus at bnet.pl
Tue Nov 13 13:07:27 CET 2001


On Tue, Nov 13, 2001 at 12:25:57AM +0100, Michael Ströder wrote:
> Jacek Konieczny wrote:
> > 
> > I will also make ldap.get_option() function and get_option/set_option
> > methods of LDAPObject.
> 
> Shouldn't the LDAPObject-related options be implemented by
> __getattr__() and __setattr__()? I have no personal preference but
> this is how it's done today (e.g. "version" etc.) and it's very
> Pythonic.

LDAP API includes ldap_set_option() function. Anybody who knows this API
will search for something similar in python-ldap. The same function is
used to set some global/default options and to set connection-specific
options. It would be quite strange to treat them differently.
I agree, that __getattr__() and __setattr__() are more Pythonic, so I
think it should stay for at least some options. The two interfaces can
coexist. In fact __setattr__() will call set_option() internally, after
translating attribute name to LDAP_OPT_* constant.

Greets,
        Jacek




More information about the python-ldap mailing list