From 620990614ec3d4ed7e31681f0e111e9a9fc11aa9 Mon Sep 17 00:00:00 2001 From: stroeder Date: Fri, 18 Sep 2015 20:20:32 +0000 Subject: [PATCH] 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. --- CHANGES | 6 +++++- Lib/ldap/resiter.py | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 8869884..3e88321 100644 --- a/CHANGES +++ b/CHANGES @@ -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 $ diff --git a/Lib/ldap/resiter.py b/Lib/ldap/resiter.py index e34fad6..fdbbc3e 100644 --- a/Lib/ldap/resiter.py +++ b/Lib/ldap/resiter.py @@ -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()