]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Fixing lib/pp_admintools/ldap_config.py
authorFrank Brehm <frank@brehm-online.com>
Wed, 18 May 2022 11:37:40 +0000 (13:37 +0200)
committerFrank Brehm <frank@brehm-online.com>
Wed, 18 May 2022 11:37:40 +0000 (13:37 +0200)
lib/pp_admintools/ldap_config.py

index 79b8df9fefff0b5c5cceb1cee001be3911244ebd..5368abc4569af893a44209c63c17666ba825f382 100644 (file)
@@ -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: