[python-ldap] Patch for ReconnectLDAPObject

Michael Ströder michael at stroeder.com
Sat Nov 23 15:19:12 CET 2013


Jonathan Giannuzzi wrote:
> Michael Ströder wrote:
> 
>> Jonathan Giannuzzi wrote:
>>> Dylan Jay wrote:
>>>> This patch seems to work really well. Any chance of getting it included in a release?
>>>
>>> What is your view on this patch?
>>
>> It's on my to-do list to carefully look at it. Maybe during the next days...
>>
>>> Are there any specific issues preventing it from getting merged?
>>
>> Hmm, in former times there were Python installations built without threading
>> support. So I'm a bit cautious regarding backward compability.
> 
> I was using dummy_threading as a fallback for Python installations built without threading, which was introduced in Python 2.3.
> On top of that, I was using the PEP8-compliant API (thus no camelCase) which was introduced in Python 2.6.
> 
> In order to be more compatible, I changed the patch to use a dummy condition instead of dummy_threading (similar to DummyLock in ldap/__init__.py)
> I also changed it to use the camelCase threading API.
> 
> AFAIK, it should work against Python >= 1.5.1, with or without threads.
> I tested it against Python 2.5 (threads), 2.6 (threads and no threads) and 2.7 (threads and no threads).
> Unfortunately I don't have easy access to older installations of Python.

I've committed a slightly other approach using ldap.LDAPLock class. The most
important point is the try-finally-statement within method
ReconnectLDAPObject.reconnect() to be sure that the lock gets released if
anything goes wrong therein.

Please test the CVS version and let me know whether you think something's missing.

Ciao, Michael.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2398 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20131123/944e3b41/attachment.bin>


More information about the python-ldap mailing list