364 class LDAPConnection(object): … 391 » def __exit__(self, exc_type, exc_value, traceback): 392 » » if exc_type is not None and isinstance(exc_type, type(ldap.LDAPError)): 393 » » » LDAPConnection.lo = None 394 » » » univention.debug.debug(univention.debug.LISTENER, univention.debug.ERROR, 'ucsschool-user-logonscripts: a LDAP error occurred - invalidating LDAP connection - error=%r' % (exc_value[0]['desc'],)) The check "isinstance(exc_type, type(ldap.LDAPError))" will never become true because type(ldap.LDAPError) is type and exc_type is always an instance of Exception. Fix: - if exc_type is not None and isinstance(exc_type, type(ldap.LDAPError)): + if exc_type is not None and isinstance(exc_type, (ldap.LDAPError,)):
s/never/always/ s/instance/subclass/ The check "isinstance(exc_type, type(ldap.LDAPError))" will always become true because type(ldap.LDAPError) is type and exc_type is always an subclass of Exception. - if exc_type is not None and isinstance(exc_type, type(ldap.LDAPError)): + if exc_type is not None and isinstance(exc_value, (ldap.LDAPError,)):
I had to fix this bug as otherwise any error results in no script written at all. *** This bug has been marked as a duplicate of bug 41304 ***
ACK: bug crashed script, was fixed.