from .ldap import BaseLdapApplication
from ..xlate import XLATOR
-__version__ = '0.6.1'
+__version__ = '0.6.2'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
use_default_ldap_connection = False
use_multiple_ldap_connections = False
show_cmdline_ldap_timeout = True
- apply_default_ldap_instance_if_not_given = False
+ apply_default_ldap_instance_if_not_given = True
+ default_default_ldap_instance = 'dpx-prod-mail'
# -------------------------------------------------------------------------
def __init__(self, appname=None, base_dir=None):
# rom ..config.ldap import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS
from ..config.ldap import DEFAULT_TIMEOUT
-__version__ = '0.11.3'
+__version__ = '0.11.4'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
use_multiple_ldap_connections = False
show_cmdline_ldap_timeout = True
apply_default_ldap_instance_if_not_given = True
+ default_default_ldap_instance = 'default'
# pattern_re_ldap_dn = (
# '^([a-z][a-z0-9-]*)=(?![ #])(((?![\\="+,;<>]).)|(\\[ \\#="+,;<>])|(\\[a-f0-9][a-f0-9]))*'
}
help_default_inst = _(
- "If not given, then the instance {!r} will be used.").format('default')
+ "If not given, then the instance {!r} will be used.").format(self.default_default_ldap_instance)
help_single = _(
"The LDAP instance (LDAP cluster) from configuration, "
self._init_default_connection()
if self.use_default_ldap_connection:
- self.ldap_instances = ['default']
+ self.ldap_instances = [self.default_default_ldap_instance]
return
LOG.debug(_("Checking given instances."))
if inst_cleared != '':
self.ldap_instances.append(inst.lower())
else:
- self.ldap_instances = ['default']
+ self.ldap_instances = [self.default_default_ldap_instance]
self._verify_instances()
instances = []
for inst in self.cfg.ldap_connection.keys():
- if inst != 'default':
+ if inst != self.default_default_ldap_instance:
instances.append(inst)
instances.sort(key=str.lower)
- if 'default' in self.cfg.ldap_connection:
- instances.insert(0, 'default')
+ if self.default_default_ldap_instance in self.cfg.ldap_connection:
+ instances.insert(0, self.default_default_ldap_instance)
max_key_len = 1
max_tier_len = 1
self.ldap_instances = filtered_instances
return
- if 'default' in self.cfg.ldap_connection:
+ if self.default_default_ldap_instance in self.cfg.ldap_connection:
if self.apply_default_ldap_instance_if_not_given:
- filtered_instances.insert(0, 'default')
+ filtered_instances.insert(0, self.default_default_ldap_instance)
all_ok = True
for given_inst in self.ldap_instances:
# -------------------------------------------------------------------------
def _init_default_connection(self):
- if 'default' in self.cfg.ldap_connection:
- default_connection = self.cfg.ldap_connection['default']
+ if self.default_default_ldap_instance in self.cfg.ldap_connection:
+ default_connection = self.cfg.ldap_connection[self.default_default_ldap_instance]
else:
default_connection = LdapConnectionInfo(
appname=self.appname, verbose=self.verbose, base_dir=self.base_dir,
base_dn=LdapConfiguration.default_base_dn,
bind_dn=LdapConfiguration.default_bind_dn,
initialized=False)
- self.cfg.ldap_connection['default'] = default_connection
+ self.cfg.ldap_connection[self.default_default_ldap_instance] = default_connection
v = getattr(self.args, 'ldap_host', None)
if v: