[gen] Bugfixes in mail and ldap configs.

This commit is contained in:
Gaetan Delannay 2015-01-27 15:45:15 +01:00
parent bfb10675de
commit 9566a7d788
3 changed files with 8 additions and 3 deletions

View file

@ -336,7 +336,7 @@ class ZopeInstaller:
if not getattr(cfg, sv): continue if not getattr(cfg, sv): continue
svConfig = getattr(cfg, sv) svConfig = getattr(cfg, sv)
enabled = svConfig.enabled and 'enabled' or 'disabled' 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: if servers:
self.logger.info('server(s) %s configured.' % ', '.join(servers)) self.logger.info('server(s) %s configured.' % ', '.join(servers))

View file

@ -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') log('%s: mail sending failed (%s)' % (config, str(e)), type='error')
except socket.error, se: except socket.error, se:
if log: if log:
log('%s: mail sending failed (%s)' % (config, str(e)), type='error') log('%s: mail sending failed (%s)' % (config, str(se)),type='error')
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View file

@ -18,7 +18,7 @@ class LdapConfig:
def __init__(self): def __init__(self):
self.server = '' # Name of the LDAP server 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 # Login and password of the technical power user that the Appy
# application will use to connect to the LDAP. # application will use to connect to the LDAP.
self.adminLogin = '' self.adminLogin = ''
@ -49,6 +49,11 @@ class LdapConfig:
# "roles": a list of global role names. # "roles": a list of global role names.
self.userMap = {} self.userMap = {}
def __repr__(self):
'''Short string representation of this ldap config, for logging and
debugging purposes.'''
return self.getServerUri()
def getServerUri(self): def getServerUri(self):
'''Returns the complete URI for accessing the LDAP, ie '''Returns the complete URI for accessing the LDAP, ie
"ldap://some.ldap.server:389".''' "ldap://some.ldap.server:389".'''