I was thinking more of a search_defaults parameter to pass to the __init__.


On Sat, Sep 28, 2013 at 3:53 AM, Wil Cooley <notifications@github.com>wrote:

> In simpleldap/__init__.py:
>
> > @@ -155,6 +158,31 @@ def __init__(self, hostname, port=None, dn='', password='',
> >              self.connection.start_tls_s()
> >          self.connection.simple_bind_s(
> dn, password)
> >
> > +    def search_defaults(self, **kwargs):
> > +        """
> > +        Set defaults for search.
> > +
> > +        conn.search_defaults(basedn='dc=example,dc=com', timeout=100)
> > +        conn.search_defaults(attrs=['cn'], scope=ldap.SCOPE_BASE)
> > +
> > +        """
> > +        self._search_defaults.update(kwargs)
> > +
> > +    def reset_search_defaults(self, args):
>
> clear is fine with me.
>
> I am uncertain about setting the defaults based on a call to the searchmethod; do you set the defaults only if defaults aren't set already (which
> could be surprising) or do you overwrite the defaults unconditionally
> (which could also be surprising)? Perhaps an set_search_defaultsparameter to
> search could make that explicit?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/gdub/python-simpleldap/pull/2/files#r6643759>
> .
>