ldap.set_option() ready

Michael Ströder michael at stroeder.com
Tue Nov 13 10:54:36 CET 2001


David Leonard wrote:
> 
> On Tue, 13 Nov 2001, Michael Ströder typed thusly:
> 
> > 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.
> 
> you mean, like this?
> 
>         print ldap.option.api_info
> 
>         ldap.option.debug_level = 2
> 
> i think it is just as easy doing it the current get_option() way,
> and means that OpenLDAP's documentation/manuals remains sensible for
> people who want to read up on what the options mean.
> 
> The only real plus I can think of with attributes is that you have the
> advantage of hasattr() and as you say, it is more pythonic.

As I said, I have no personal preference. We can keep get_option()
to be more compliant with OpenLDAP's LDAP-EXT API. I can do the
Pythonic way in a Python wrapper module above if needed some time.

Ciao, Michael.




More information about the python-ldap mailing list