ldap.set_option() ready

David Leonard david.leonard at itee.uq.edu.au
Tue Nov 13 03:59:59 CET 2001


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.

d
-- 
David Leonard                           David.Leonard at itee.uq.edu.au
Dept of Inf. Tech. and Elec. Engg   _   Ph:+61 404 844 850
The University of Queensland       |+|  http://www.itee.uq.edu.au/~leonard/
QLD 4072  AUSTRALIA               ~` '~ B73CD65FBEF4C089B79A8EBADF1A932F13EA0FC8






More information about the python-ldap mailing list