Skip to content

Commit

Permalink
removed class ldap.ldapobject.NonblockingLDAPObject
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder authored and Petr Viktorin committed Nov 22, 2017
1 parent 5bdd161 commit 4a9591c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Modules/
Lib/
* removed all dependencies on modules string and types
* removed use of .has_key()
* removed class ldap.ldapobject.NonblockingLDAPObject
* new global constant ldap.LIBLDAP_API_INFO
* right after importing _ldap there is a call into libldap to initialize it
* method .decodeControlValue() of SSSResponseControl and VLVResponseControl
Expand Down
37 changes: 1 addition & 36 deletions Lib/ldap/ldapobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

from os import strerror

from ldap import __version__
from ldap.pkginfo import __version__, __author__, __license__

__all__ = [
'LDAPObject',
'SimpleLDAPObject',
'NonblockingLDAPObject',
'ReconnectLDAPObject',
]

Expand Down Expand Up @@ -760,40 +759,6 @@ def get_naming_contexts(self):
).get('namingContexts', [])


class NonblockingLDAPObject(SimpleLDAPObject):

def __init__(self,uri,trace_level=0,trace_file=None,result_timeout=-1):
self._result_timeout = result_timeout
SimpleLDAPObject.__init__(self,uri,trace_level,trace_file)

def result(self,msgid=ldap.RES_ANY,all=1,timeout=-1):
"""
"""
ldap_result = self._ldap_call(self._l.result,msgid,0,self._result_timeout)
if not all:
return ldap_result
start_time = time.time()
all_results = []
while all:
while ldap_result[0] is None:
if (timeout>=0) and (time.time()-start_time>timeout):
self._ldap_call(self._l.abandon,msgid)
raise ldap.TIMEOUT(
"LDAP time limit (%d secs) exceeded." % (timeout)
)
time.sleep(0.00001)
ldap_result = self._ldap_call(self._l.result,msgid,0,self._result_timeout)
if ldap_result[1] is None:
break
all_results.extend(ldap_result[1])
ldap_result = None,None
return all_results

def search_st(self,base,scope,filterstr='(objectClass=*)',attrlist=None,attrsonly=0,timeout=-1):
msgid = self.search(base,scope,filterstr,attrlist,attrsonly)
return self.result(msgid,all=1,timeout=timeout)


class ReconnectLDAPObject(SimpleLDAPObject):
"""
In case of server failure (ldap.SERVER_DOWN) the implementations
Expand Down

0 comments on commit 4a9591c

Please sign in to comment.