From: Frank Brehm Date: Wed, 18 May 2022 11:37:40 +0000 (+0200) Subject: Fixing lib/pp_admintools/ldap_config.py X-Git-Tag: 0.4.2^2~5^2~9 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=5e0bd14b2ef7aebd8cf0b56c6c043ddd5a870cc3;p=pixelpark%2Fpp-admin-tools.git Fixing lib/pp_admintools/ldap_config.py --- diff --git a/lib/pp_admintools/ldap_config.py b/lib/pp_admintools/ldap_config.py index 79b8df9..5368abc 100644 --- a/lib/pp_admintools/ldap_config.py +++ b/lib/pp_admintools/ldap_config.py @@ -12,6 +12,7 @@ from __future__ import absolute_import # Standard module import logging import copy +import re # Third party modules @@ -30,7 +31,7 @@ from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR from .xlate import XLATOR -__version__ = '0.2.1' +__version__ = '0.2.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -127,17 +128,17 @@ class LdapConnectionInfo(FbBaseObject): @property def use_ldaps(self): """Should there be used LDAPS for communicating with the LDAP server?""" - return self.use_ldaps + return self._use_ldaps @use_ldaps.setter def use_ldaps(self, value): - self.use_ldaps = to_bool(value) + self._use_ldaps = to_bool(value) # ----------------------------------------------------------- @property def port(self): "The TCP port number of the LDAP server." - return self._api_port + return self._port @port.setter def port(self, value): @@ -271,7 +272,7 @@ class LdapConnectionDict(dict, FbGenericBaseObject): new = self.__class__() for key in self.keys(): - new[key] = copy.copy(self.[key]) + new[key] = copy.copy(self[key]) return new @@ -369,12 +370,12 @@ class LdapConfiguration(BaseMultiConfig): msg = _("Value {!r} for a timeout is invalid:").format(value) msg += ' ' + str(e) LOG.error(msg) - continue + return if timeout <= 0 or timeout > MAX_TIMEOUT: msg = _("Value {!r} for a timeout is invalid:").format(value) msg += ' ' + str(e) LOG.error(msg) - continue + return self.ldap_timeout = timeout @@ -392,7 +393,7 @@ class LdapConfiguration(BaseMultiConfig): value = section[key] - if self.re_ldap_host_key.match(key) + if self.re_ldap_host_key.match(key): if value.strip(): connection.host = value else: