Add msgid to info dict created by LDAPerror.

Michael Ströder michael at
Fri Oct 23 11:22:58 CEST 2009

Chris Dukes wrote:
> While rewriting a nasty perl LDAP sync program in python I encountered
> one quirk with python-ldap that made my life a bit difficult.  When
> doing asynchronous searches an ldap exception in result3() doesn't
> include 'msgid' in the info dict.  Since I'm tracking pending work by
> the msgid of the search, having the msgid in the exception is very
> useful for removing work items.

This is only useful if you sent several LDAP operations with asynchronous
methods and then poll *all* results with LDAPObject.result3(msgid=-1).

This is a very special use-case. I'd be curious to see some code illustrating
this *before* applying your patch.

BTW: I still have an idea to eliminate all the thread-locking in LDAPObject by
serializing all calls into _ldap module within the wrapper class. For this
your patch could be useful. Still I think about some implications of this
approach (polling results is CPU intensive, how is invoking result triggered
without the need for a separate thread). So again your client code could be an
useful inspiration for this.

Ciao, Michael.

More information about the python-ldap mailing list