This is a mix-in class to be used with class ldap.LDAPObject or derived classes which has these methods:
- ResultProcessor.allresults(msgid, timeout=-1)¶
Generator function which returns an iterator for processing all LDAP operation results of the given msgid retrieved with LDAPObject.result3() -> 4-tuple
This example demonstrates how to use mix-in class ldap.resiter.ResultProcessor for retrieving results formerly requested with ldap.LDAPObject.search() and processing them in a for-loop.
import sys,ldap,ldap.resiter
class MyLDAPObject(ldap.ldapobject.LDAPObject,ldap.resiter.ResultProcessor):
pass
l = MyLDAPObject('ldap://localhost')
# Asynchronous search method
msg_id = l.search('dc=stroeder,dc=com',ldap.SCOPE_SUBTREE,'(objectClass=*)')
for res_type,res_data,res_msgid,res_controls in self.source.allresults(msg_id):
for dn,entry in res_data:
# process dn and entry
print dn,entry['objectClass']