Skip to content

Instantly share code, notes, and snippets.

@felipe-prenholato
Created March 21, 2011 19:09
Show Gist options
  • Save felipe-prenholato/880008 to your computer and use it in GitHub Desktop.
Save felipe-prenholato/880008 to your computer and use it in GitHub Desktop.
Index: __init__.py
===================================================================
--- __init__.py (revision 995)
+++ __init__.py (working copy)
@@ -89,10 +89,20 @@
def search_s(self, base, scope, filterstr, attrlist):
cursor = self._cursor()
- results = cursor.connection.search_s(base, scope, filterstr.encode(self.charset), attrlist)
output = []
- for dn, attrs in results:
- output.append((dn.decode(self.charset), attrs))
+ search = cursor.connection.search(base, scope, filterstr.encode(self.charset), attrlist)
+ if type(search) is int:
+ while True:
+ dn,attrs = cursor.connection.result(search,2)[1][0]
+ if not dn:
+ break
+ output.append((dn.decode(self.charset), attrs))
+ else:
+ results = search
+ for dn, attrs in results:
+ output.append((dn.decode(self.charset), attrs))
+
+
return output
# FIXME: is this the right place to initialize the LDAP connection?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment