[PEAK] LDAP.py small fix for current python-ldap module (2.0.4)

Ulrich Eck ueck at net-labs.de
Mon Mar 21 05:00:45 EST 2005


Hi Phillip,

there seems to be a change in one of the last releases of python-ldap
that is not 100% compatible with the current peak/storage/LDAP.py
implementation:

currently rows are fetched "while restype != 'RES_SEARCH_RESULT'" but
restype will be set to ldap.RES_SEARCH_RESULT (equals 101) by calling
restype, data = connection.result(..)

here is the diff to make the Current implementation of LDAP-Connections
work with python-ldap. i have no clue if older versions of python-ldap
did export the constant RES_SEARCH_RESULT as well - but probably not,
otherwise Ty would have used it.

the diff:
--- LDAP.py.peak_orig   Mon Mar 21 11:51:57 2005
+++ LDAP.py     Mon Mar 21 11:52:47 2005
@@ -15,7 +15,7 @@

 try:
     import ldap
-    from ldap import SCOPE_BASE, SCOPE_ONELEVEL, SCOPE_SUBTREE
+    from ldap import SCOPE_BASE, SCOPE_ONELEVEL, SCOPE_SUBTREE,
RES_SEARCH_RESULT

 except:
     ldap = None
@@ -123,7 +123,7 @@

         restype = None

-        while restype != 'RES_SEARCH_RESULT':
+        while restype != RES_SEARCH_RESULT:

             try:
                 restype, data = fetch(msgid, getall, timeout)

-------------------------
cheers
Ulrich




More information about the PEAK mailing list