ldap.resiter.ResultProcessor.allresults() now takes new key-word

argument add_ctrls which is internally passed to LDAPObject.result4()
and lets the method also return response control along with the search
results.
This commit is contained in:
stroeder
2015-09-18 20:20:32 +00:00
parent f79033ba4a
commit 620990614e
2 changed files with 9 additions and 5 deletions

View File

@@ -6,6 +6,10 @@ Changes since 2.4.20:
Lib/
* LDAPObject.read_s() now returns None instead of raising
ldap.NO_SUCH_OBJECT in case the search operation returned emtpy result.
* ldap.resiter.ResultProcessor.allresults() now takes new key-word
argument add_ctrls which is internally passed to LDAPObject.result4()
and lets the method also return response control along with the search
results.
Tests/
* Unit tests for module ldif (thanks to Petr Viktorin)
@@ -1190,4 +1194,4 @@ Released 2.0.0pre02 2002-02-01
----------------------------------------------------------------
Released 1.10alpha3 2000-09-19
$Id: CHANGES,v 1.353 2015/09/18 14:51:44 stroeder Exp $
$Id: CHANGES,v 1.354 2015/09/18 20:20:32 stroeder Exp $

View File

@@ -3,7 +3,7 @@ ldap.resiter - processing LDAP results with iterators
See http://www.python-ldap.org/ for details.
\$Id: resiter.py,v 1.6 2011/07/28 08:23:32 stroeder Exp $
\$Id: resiter.py,v 1.7 2015/09/18 20:20:32 stroeder Exp $
Python compability note:
Requires Python 2.3+
@@ -15,15 +15,15 @@ class ResultProcessor:
Mix-in class used with ldap.ldapopbject.LDAPObject or derived classes.
"""
def allresults(self,msgid,timeout=-1):
def allresults(self,msgid,timeout=-1,add_ctrls=0):
"""
Generator function which returns an iterator for processing all LDAP operation
results of the given msgid retrieved with LDAPObject.result3() -> 4-tuple
"""
result_type,result_list,result_msgid,result_serverctrls = self.result3(msgid,0,timeout)
result_type,result_list,result_msgid,result_serverctrls,_,_ = self.result4(msgid,0,timeout,add_ctrls=add_ctrls)
while result_type and result_list:
# Loop over list of search results
for result_item in result_list:
yield (result_type,result_list,result_msgid,result_serverctrls)
result_type,result_list,result_msgid,result_serverctrls = self.result3(msgid,0,timeout)
result_type,result_list,result_msgid,result_serverctrls,_,_ = self.result4(msgid,0,timeout,add_ctrls=add_ctrls)
return # allresults()