from ..xlate import XLATOR
+from ..config.mirror_ldap import MirrorLdapConfiguration
+
# from .ldap import LdapAppError, FatalLDAPError
from .ldap import LdapAppError
from .ldap import BaseLdapApplication
from ..argparse_actions import NonNegativeItegerOptionAction
from ..argparse_actions import LimitedFloatOptionAction
-__version__ = '0.4.2'
+__version__ = '0.5.0'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
self._force_desc_msg = _("Do not execute a countdown before starting the application.")
super(MirrorLdapApplication, self).__init__(
- appname=appname, description=desc, base_dir=base_dir, initialized=False)
+ appname=appname, description=desc, base_dir=base_dir,
+ cfg_class=MirrorLdapConfiguration, initialized=False)
self.initialized = True
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+@summary: A module for providing a configuration for the mirror-ldap application.
+
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2022 by Frank Brehm, Berlin
+"""
+from __future__ import absolute_import
+
+# Standard module
+import logging
+# import copy
+# import re
+
+# Third party modules
+from fb_tools.common import is_sequence, pp
+from fb_tools.multi_config import DEFAULT_ENCODING
+
+# Own modules
+from .. import DEFAULT_CONFIG_DIR
+
+from .ldap import LdapConfigError, LdapConfiguration
+
+from ..xlate import XLATOR
+
+__version__ = '0.1.0'
+LOG = logging.getLogger(__name__)
+
+_ = XLATOR.gettext
+
+
+# =============================================================================
+class MirrorLdapConfigError(LdapConfigError):
+ """Error class for configuration errors of the mirror-ldap application."""
+
+ pass
+
+
+# =============================================================================
+class MirrorLdapConfiguration(LdapConfiguration):
+ """A class for configuring the mirror-ldap application."""
+
+ # -------------------------------------------------------------------------
+ def __init__(
+ self, appname=None, verbose=0, version=__version__, base_dir=None,
+ append_appname_to_stems=True, additional_stems=None, config_dir=DEFAULT_CONFIG_DIR,
+ additional_config_file=None, additional_cfgdirs=None, encoding=DEFAULT_ENCODING,
+ ensure_privacy=False, use_chardet=True, initialized=False):
+
+ self.entries_keep = {}
+ self.transform = {}
+
+ add_stems = []
+ if additional_stems:
+ if is_sequence(additional_stems):
+ for stem in additional_stems:
+ add_stems.append(stem)
+ else:
+ add_stems.append(additional_stems)
+
+ if 'mirror-ldap' not in add_stems:
+ add_stems.append('mirror-ldap')
+
+ super(MirrorLdapConfiguration, self).__init__(
+ appname=appname, verbose=verbose, version=version, base_dir=base_dir,
+ append_appname_to_stems=append_appname_to_stems, config_dir=config_dir,
+ additional_stems=add_stems, additional_config_file=additional_config_file,
+ additional_cfgdirs=additional_cfgdirs, encoding=encoding, use_chardet=use_chardet,
+ ensure_privacy=ensure_privacy, initialized=False,
+ )
+
+ self.initialized = True
+
+ # -------------------------------------------------------------------------
+ def eval_section(self, section_name):
+
+ sn = section_name.lower()
+ section = self.cfg[section_name]
+
+ if self.verbose > 1:
+ LOG.debug(_("Evaluating configuration section {sn!r} ...").format(sn=sn))
+
+ if self.verbose > 3:
+ LOG.debug("Section:\n" + pp(section))
+
+ super(MirrorLdapConfiguration, self).eval_section(section_name)
+
+
+# =============================================================================
+if __name__ == "__main__":
+
+ pass
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list