Changeset 968

Show
Ignore:
Timestamp:
04/27/03 10:27:34 (22 years ago)
Author:
jalet
Message:

connection to LDAP backend

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/ldap.py

    r967 r968  
    2121# 
    2222# $Log$ 
     23# Revision 1.2  2003/04/27 08:27:34  jalet 
     24# connection to LDAP backend 
     25# 
    2326# Revision 1.1  2003/04/27 08:04:15  jalet 
    2427# LDAP storage backend's skeleton added. DOESN'T WORK. 
     
    4245        """Opens the LDAP connection.""" 
    4346        raise PyKotaStorageError, "Sorry, the LDAP backend for PyKota is not yet implemented !" 
     47        self.closed = 1 
     48        try : 
     49            self.database = ldap.initialize(host)  
     50            self.database.simple_bind_s(user, passwd) 
     51            # TODO : dbname will be the base dn 
     52        except ldap.SERVER_DOWN :     
     53            raise PyKotaStorageError, "LDAP backend for PyKota seems to be down !" # TODO : translate 
     54        else :     
     55            self.closed = 0 
    4456             
    4557    def __del__(self) :         
    4658        """Closes the database connection.""" 
    47         pass 
     59        if not self.closed : 
     60            del self.database 
     61            self.closed = 1 
    4862         
    4963    def doQuery(self, query) :