From 9566a7d788a317b8f9dd045506148eb4e27a9fa5 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Tue, 27 Jan 2015 15:45:15 +0100 Subject: [PATCH] [gen] Bugfixes in mail and ldap configs. --- gen/installer.py | 2 +- gen/mail.py | 2 +- shared/ldap_connector.py | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gen/installer.py b/gen/installer.py index 638e289..2548133 100644 --- a/gen/installer.py +++ b/gen/installer.py @@ -336,7 +336,7 @@ class ZopeInstaller: if not getattr(cfg, sv): continue svConfig = getattr(cfg, sv) enabled = svConfig.enabled and 'enabled' or 'disabled' - servers.append('%s (%s, %s)' % (svConfig.server, sv, enabled)) + servers.append('%s (%s, %s)' % (svConfig, sv, enabled)) if servers: self.logger.info('server(s) %s configured.' % ', '.join(servers)) diff --git a/gen/mail.py b/gen/mail.py index 8fbd56f..bf4ba4b 100644 --- a/gen/mail.py +++ b/gen/mail.py @@ -125,5 +125,5 @@ def sendMail(config, to, subject, body, attachments=None, log=None): log('%s: mail sending failed (%s)' % (config, str(e)), type='error') except socket.error, se: if log: - log('%s: mail sending failed (%s)' % (config, str(e)), type='error') + log('%s: mail sending failed (%s)' % (config, str(se)),type='error') # ------------------------------------------------------------------------------ diff --git a/shared/ldap_connector.py b/shared/ldap_connector.py index 35289ee..e43f2cd 100644 --- a/shared/ldap_connector.py +++ b/shared/ldap_connector.py @@ -18,7 +18,7 @@ class LdapConfig: def __init__(self): self.server = '' # Name of the LDAP server - self.port = None # Port for this server. + self.port = None # Port for this server # Login and password of the technical power user that the Appy # application will use to connect to the LDAP. self.adminLogin = '' @@ -49,6 +49,11 @@ class LdapConfig: # "roles": a list of global role names. self.userMap = {} + def __repr__(self): + '''Short string representation of this ldap config, for logging and + debugging purposes.''' + return self.getServerUri() + def getServerUri(self): '''Returns the complete URI for accessing the LDAP, ie "ldap://some.ldap.server:389".'''