From: Frank Brehm Date: Wed, 22 Mar 2017 15:40:02 +0000 (+0100) Subject: Bugfixing X-Git-Tag: 0.1.2~230 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=a3e3dfbc09b3ca0e90493a5a718b761fa7cf83df;p=pixelpark%2Fadmin-tools.git Bugfixing --- diff --git a/pp_lib/cfg_app.py b/pp_lib/cfg_app.py index e2ea0d2..793c05f 100644 --- a/pp_lib/cfg_app.py +++ b/pp_lib/cfg_app.py @@ -44,7 +44,7 @@ from .mailaddress import MailAddress from .app import PpApplication -__version__ = '0.5.1' +__version__ = '0.5.2' LOG = logging.getLogger(__name__) VALID_MAIL_METHODS = ('smtp', 'sendmail') @@ -472,40 +472,45 @@ class PpConfigApplication(PpApplication): if 'mail_recipients' in section: v = section['mail_recipients'].strip() self.mail_recipients = [] - tokens = self.whitespace_re.split(v) - for token in tokens: - if MailAddress.valid_address(token): - if token not in self.mail_recipients: - self.mail_recipients.append(token) - else: - msg = "Found invalid recipient mail address {!r} in configuration.".format( - token) - LOG.error(msg) + if v: + tokens = self.whitespace_re.split(v) + for token in tokens: + if MailAddress.valid_address(token): + if token not in self.mail_recipients: + self.mail_recipients.append(token) + else: + msg = ( + "Found invalid recipient mail address {!r} " + "in configuration.").format( + token) + LOG.error(msg) if 'mail_cc' in section: v = section['mail_cc'].strip() self.mail_cc = [] - tokens = self.whitespace_re.split(v) - for token in tokens: - if MailAddress.valid_address(token): - if token not in self.mail_cc: - self.mail_cc.append(token) - else: - msg = "Found invalid cc mail address {!r} in configuration.".format( - token) - LOG.error(msg) + if v: + tokens = self.whitespace_re.split(v) + for token in tokens: + if MailAddress.valid_address(token): + if token not in self.mail_cc: + self.mail_cc.append(token) + else: + msg = "Found invalid cc mail address {!r} in configuration.".format( + token) + LOG.error(msg) if 'reply_to' in section: v = section['reply_to'].strip() self.reply_to = None - tokens = self.whitespace_re.split(v) - if len(tokens): - if MailAddress.valid_address(tokens[0]): - self.reply_to = tokens[0] - else: - msg = "Found invalid reply mail address {!r} in configuration.".format( - tokens[0]) - LOG.error(msg) + if v: + tokens = self.whitespace_re.split(v) + if len(tokens): + if MailAddress.valid_address(tokens[0]): + self.reply_to = tokens[0] + else: + msg = "Found invalid reply mail address {!r} in configuration.".format( + tokens[0]) + LOG.error(msg) if 'mail_server' in section: v = section['reply_to'].strip()