X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FLDAP.py;h=86250125f908e59784b9545cf7a8c547907f5363;hb=3b44c0228c26dc43d985185afc225caa5f48c1fb;hp=da54456b552754621ca1b2c05f0eb8de8abba14e;hpb=997c5bbe5b0576ae8c9c8d52a80dab1dcecf615a;p=plcapi.git diff --git a/PLC/LDAP.py b/PLC/LDAP.py index da54456..8625012 100644 --- a/PLC/LDAP.py +++ b/PLC/LDAP.py @@ -4,7 +4,7 @@ # Copyright (C) 2006 The Trustees of Princeton University # -import ldap +from . import ldap import traceback from PLC.Debug import profile from PLC.Faults import * @@ -35,8 +35,8 @@ class LDAP: self.connection.bind(dn, pw, ldap.AUTH_SIMPLE) else: self.connection.bind_s(dn, pw, ldap.AUTH_SIMPLE) - except ldap.LDAPError, e: - raise PLCLDAPError, "Unable to bind to server: %s" % e + except ldap.LDAPError as e: + raise PLCLDAPError("Unable to bind to server: %s" % e) return connection def close(self): @@ -66,7 +66,7 @@ class LDAP: def to_ldap_filter(search_filter): search_filter = pl_to_ldap(search_filter) values = [] - for (key,value) in search_filter.items(): + for (key,value) in list(search_filter.items()): values.append("(%s=%s)" % (key,value)) return "(&%s)" % "".join(values)