Changeset 1170 for pykota/trunk

Show
Ignore:
Timestamp:
10/24/03 10:37:55 (21 years ago)
Author:
jalet
Message:

More complete messages in case of LDAP failure.
LDAP database connection is now unbound on exit too.

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/NEWS

    r1168 r1170  
    2222PyKota NEWS : 
    2323 
     24    - 1.16alpha1 : 
     25     
     26        - Ensures that the LDAP connection is really closed at end. 
     27         
     28        - More complete error messages in case of LDAP operation failure. 
     29         
    2430    - 1.15 : 
    2531      
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1149 r1170  
    2222# 
    2323# $Log$ 
     24# Revision 1.34  2003/10/24 08:37:55  jalet 
     25# More complete messages in case of LDAP failure. 
     26# LDAP database connection is now unbound on exit too. 
     27# 
    2428# Revision 1.33  2003/10/08 07:01:20  jalet 
    2529# Job history can be disabled. 
     
    176180        """Closes the database connection.""" 
    177181        if not self.closed : 
    178             del self.database 
     182            self.database.unbind_s() 
    179183            self.closed = 1 
    180184            self.tool.logdebug("Database closed.") 
     
    205209            self.tool.logdebug("QUERY : Filter : %s, BaseDN : %s, Scope : %s, Attributes : %s" % (key, base, scope, fields)) 
    206210            result = self.database.search_s(base or self.basedn, scope, key, fields) 
    207         except ldap.LDAPError :     
    208             raise PyKotaStorageError, _("Search for %s(%s) from %s(scope=%s) returned no answer.") % (key, fields, base, scope) 
     211        except ldap.LDAPError, msg :     
     212            raise PyKotaStorageError, (_("Search for %s(%s) from %s(scope=%s) returned no answer.") % (key, fields, base, scope)) + " : %s" % str(msg) 
    209213        else :      
    210214            self.tool.logdebug("QUERY : Result : %s" % result) 
     
    216220            self.tool.logdebug("QUERY : ADD(%s, %s)" % (dn, str(fields))) 
    217221            self.database.add_s(dn, modlist.addModlist(fields)) 
    218         except ldap.LDAPError : 
    219             raise PyKotaStorageError, _("Problem adding LDAP entry (%s, %s)") % (dn, str(fields)) 
     222        except ldap.LDAPError, msg : 
     223            raise PyKotaStorageError, (_("Problem adding LDAP entry (%s, %s)") % (dn, str(fields))) + " : %s" % str(msg) 
    220224        else : 
    221225            return dn 
     
    226230            self.tool.logdebug("QUERY : Delete(%s)" % dn) 
    227231            self.database.delete_s(dn) 
    228         except ldap.LDAPError : 
    229             raise PyKotaStorageError, _("Problem deleting LDAP entry (%s)") % dn 
     232        except ldap.LDAPError, msg : 
     233            raise PyKotaStorageError, (_("Problem deleting LDAP entry (%s)") % dn) + " : %s" % str(msg) 
    230234             
    231235    def doModify(self, dn, fields, ignoreold=1) : 
     
    235239            self.tool.logdebug("QUERY : Modify(%s, %s ==> %s)" % (dn, oldentry[0][1], fields)) 
    236240            self.database.modify_s(dn, modlist.modifyModlist(oldentry[0][1], fields, ignore_oldexistent=ignoreold)) 
    237         except ldap.LDAPError : 
    238             raise PyKotaStorageError, _("Problem modifying LDAP entry (%s, %s)") % (dn, fields) 
     241        except ldap.LDAPError, msg : 
     242            raise PyKotaStorageError, (_("Problem modifying LDAP entry (%s, %s)") % (dn, fields)) + " : %s" % str(msg) 
    239243        else : 
    240244            return dn 
  • pykota/trunk/pykota/version.py

    r1168 r1170  
    2222# 
    2323 
    24 __version__ = "1.15_unofficial" 
     24__version__ = "1.16alpha1_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""