Ñò /èêJc@sdZddkZddklZhdei6dei6dei6Zhdei6dei6Zde fd„ƒYZ ddd„ƒYZ de fd „ƒYZ d e fd „ƒYZ d e fd „ƒYZde fd„ƒYZdefd„ƒYZdefd„ƒYZdS(sã ldap.async - handle async LDAP operations See http://www.python-ldap.org/ for details. \$Id: async.py,v 1.28 2009/07/26 11:09:57 stroeder Exp $ Python compability note: Tested on Python 2.0+ but should run on Python 1.5.x. iÿÿÿÿN(t __version__tWrongResultTypecBseZd„Zd„ZRS(cCs#||_||_ti|ƒdS(N(treceivedResultTypetexpectedResultTypest Exceptiont__init__(tselfRR((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRs  cCsd|idi|iƒfS(Ns3Received wrong result type %s (expected one of %s).s, (RtjoinR(R((s0/usr/lib64/python2.6/site-packages/ldap/async.pyt__str__$s(t__name__t __module__RR(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRs tAsyncSearchHandlercBs_eZdZd„Zd dddd d d„Zd„Zd„Zdddd„Zd„Z RS( s6 Class for stream-processsing LDAP search results cCs||_d|_dS(sa Initialize a StreamResultHandler Parameters: l LDAPObject instance N(t_ltNonet_msgId(Rtl((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR0s iiÿÿÿÿc Cs1|ii||||||| ||ƒ |_dS(s¥ searchRoot See parameter base of method LDAPObject.search() searchScope See parameter scope of method LDAPObject.search() filterStr See parameter filter of method LDAPObject.search() attrList=None See parameter attrlist of method LDAPObject.search() attrsOnly See parameter attrsonly of method LDAPObject.search() timeout Maximum time the server shall use for search operation sizelimit Maximum number of entries a server should return (request client-side limit) serverctrls list of server-side LDAP controls clientctrls list of client-side LDAP controls N(R t search_extR( Rt searchRoott searchScopet filterStrtattrListt attrsOnlyttimeoutt sizelimitt serverctrlst clientctrls((s0/usr/lib64/python2.6/site-packages/ldap/async.pyt startSearch;s!  cCsdS(sd Do anything you want after starting search but before receiving and processing results N((R((s0/usr/lib64/python2.6/site-packages/ldap/async.pyt preProcessingbscCsdS(sE Do anything you want after receiving and processing results N((R((s0/usr/lib64/python2.6/site-packages/ldap/async.pytpostProcessinghsc Csœ|iƒd}||}d}d}d|_||_z$d\}} x|o xA|djo3| o+|ii|id|ƒ\}} } } qTW| pPnti|ƒpt |ti ƒƒ‚nxt| D]l} ||jo|id|_n<|djp ||jo|i || ƒnd}d}P|d}qÑWd\}} ||_qJWWd|o'|idjo|ii |iƒnX|i ƒ|S(s1 ignoreResultsNumber Don't process the first ignoreResultsNumber results. processResultsCount If non-zero this parameters indicates the number of results processed is limited to processResultsCount. timeout See parameter timeout of ldap.LDAPObject.result() iiN(NN(NN(RtbeginResultsDroppedtendResultBreakR R tresult3Rt_searchResultTypesthas_keyRtkeyst_processSingleResulttabandonR( RtignoreResultsNumbertprocessResultsCountRtresult_countertend_result_countertgo_aheadtpartialt result_typet result_listt result_msgidtresult_serverctrlst result_item((s0/usr/lib64/python2.6/site-packages/ldap/async.pytprocessResultsmsD     ,   cCsdS(sv Process single entry resultType result type resultItem Single item of a result list N((Rt resultTypet resultItem((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR#šs N( R R t__doc__RR RRRR0R#(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR +s    -tListcBs eZdZd„Zd„ZRS(s¾ Class for collecting all search results. This does not seem to make sense in the first place but think of retrieving exactly a certain portion of the available search results. cCsti||ƒg|_dS(N(R Rt allResults(RR((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR¯scCs|ii||fƒdS(N(R5tappend(RR1R2((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR#³s(R R R3RR#(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR4¦s tDictcBs eZdZd„Zd„ZRS(sJ Class for collecting all search results into a dictionary {dn:entry} cCsti||ƒh|_dS(N(R Rt allEntries(RR((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR¼scCs1ti|ƒo|\}}||i|((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRÍscCs´ti|ƒo |\}}||i|R@R6tKeyError(RR1R2R:R;tatv((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR#Òs    N(R R R3R RR#(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR<Çs t FileWritercBs/eZdZddd„Zd„Zd„ZRS(sH Class for writing a stream of LDAP search results to a file object tcCs/ti||ƒ||_||_||_dS(s¦ Initialize a StreamResultHandler Parameters: l LDAPObject instance f File object instance where the LDIF data is written to N(R Rt_ft headerStrt footerStr(RRtfRGRH((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRås   cCs|ii|iƒdS(ss The headerStr is written to output after starting search but before receiving and processing results. N(RFtwriteRG(R((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRôscCs|ii|iƒdS(sX The footerStr is written to output after receiving and processing results. N(RFRJRH(R((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRûs(R R R3RRR(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRDàs t LDIFWritercBs&eZdZddd„Zd„ZRS(sC Class for writing a stream LDAP search results to a LDIF file REcCsaddk}t||iƒo ||_n|i|ƒ|_ti|||ii||ƒdS(sÈ Initialize a StreamResultHandler Parameters: l LDAPObject instance writer_obj Either a file-like object or a ldif.LDIFWriter instance used for output iÿÿÿÿN(tldift isinstanceRKt _ldif_writerRDRt _output_file(RRt writer_objRGRHRL((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRs  cCs7ti|ƒo#|\}}|ii||ƒndS(N(R9R!RNtunparse(RR1R2R:R;((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR#s (R R R3RR#(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRKst DSMLWritercBs&eZdZddd„Zd„ZRS(sC Class for writing a stream LDAP search results to a DSML file REcCsaddk}t||iƒo ||_n|i|ƒ|_ti|||ii||ƒdS(sÄ Initialize a StreamResultHandler Parameters: l LDAPObject instance writer_obj Either a file-like object or a ldif.DSMLWriter instance used for output iÿÿÿÿN(tdsmlRMRRt _dsml_writerRDRRO(RRRPRGRHRS((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR%s  cCs7ti|ƒo#|\}}|ii||ƒndS(N(R9R!RTRQ(RR1R2R:R;((s0/usr/lib64/python2.6/site-packages/ldap/async.pyR#7s (R R R3RR#(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyRR s((R3tldapRR tRES_SEARCH_ENTRYtRES_SEARCH_RESULTtRES_SEARCH_REFERENCER R9RRR R4R7R<RDRKRR(((s0/usr/lib64/python2.6/site-packages/ldap/async.pyt s"      {#