[python-ldap] Ldap connectors pool

Michael Ströder michael at stroeder.com
Tue Sep 20 10:38:23 CEST 2011


Tarek Ziadé wrote:
> 2011/9/14 Michael Ströder <michael at stroeder.com>:
>> Tarek Ziadé wrote:
>>> I've been working on a pool class for ldap connectors, we're using for
>>> the Firefox Sync server.
>>> [..]
>>> Example of usage:
>>>
>>>   cm = ConnectionManager('ldap://localhost')
>>>
>>>   with cm.connection('bind', 'password') as conn:
>>>       ... do something with conn...
>>
>> Hmm, so it provides a slighty different API?
> 
> The connection manager returns ldap objects actually,
> 
> The addition is that you get a context manager to get that ldap object
> and it takes care of recycling it when you get out if the with block.

Hmm, being rather old-fashioned I'm not familiar with the context manager
paradigm which was introduced in Python 2.5. It seems to be elegant but I'm
not sure how common this is for developers using python-ldap.

So far my posting "Minimum Python version supported by python-ldap?" sent 2nd
August 2011 did not receive any answers...but this is relevant for that.

Ciao, Michael.


More information about the python-ldap mailing list