Changeset 1021 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 06/10/03 18:37:54 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1020 r1021 21 21 # 22 22 # $Log$ 23 # Revision 1.5 2003/06/10 16:37:54 jalet 24 # Deletion of the second user which is not needed anymore. 25 # Added a debug configuration field in /etc/pykota.conf 26 # All queries can now be sent to the logger in debug mode, this will 27 # greatly help improve performance when time for this will come. 28 # 23 29 # Revision 1.4 2003/06/10 10:45:32 jalet 24 30 # Not implemented methods now raise an exception when called. … … 55 61 56 62 class Storage : 57 def __init__(self, host, dbname, user, passwd) :63 def __init__(self, pykotatool, host, dbname, user, passwd) : 58 64 """Opens the LDAP connection.""" 59 65 # raise PyKotaStorageError, "Sorry, the LDAP backend for PyKota is not yet implemented !" 66 self.tool = pykotatool 67 self.debug = pykotatool.config.getDebug() 60 68 self.closed = 1 61 69 try : … … 67 75 else : 68 76 self.closed = 0 77 if self.debug : 78 self.tool.logger.log_message("Database opened (host=%s, dbname=%s, user=%s)" % (host, dbname, user), "debug") 69 79 70 80 def __del__(self) : … … 73 83 del self.database 74 84 self.closed = 1 85 if self.debug : 86 self.tool.logger.log_message("Database closed.", "debug") 75 87 76 88 def doSearch(self, key, fields, base="", scope=ldap.SCOPE_SUBTREE) : … … 78 90 try : 79 91 # prepends something more restrictive at the beginning of the base dn 92 if self.debug : 93 self.tool.logger.log_message("QUERY : BaseDN : %s, Scope : %s, Filter : %s, Attributes : %s" % ((base or self.basedn), scope, key, fields), "debug") 80 94 result = self.database.search_s(base or self.basedn, scope, key, fields) 81 95 except ldap.NO_SUCH_OBJECT :