From a0075f6f78274dbd42226868a706b03efb242978 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 29 Oct 2023 22:22:16 -0500 Subject: [PATCH] Log warning / avoid error if email profile can't be normalized e.g. if some import error happens --- tailbone/views/email.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tailbone/views/email.py b/tailbone/views/email.py index 8d227a1e..22954782 100644 --- a/tailbone/views/email.py +++ b/tailbone/views/email.py @@ -24,6 +24,7 @@ Email Views """ +import logging import re import warnings @@ -41,6 +42,9 @@ from tailbone.db import Session from tailbone.views import View, MasterView +log = logging.getLogger(__name__) + + class EmailSettingView(MasterView): """ Master view for email admin (settings/preview). @@ -103,7 +107,13 @@ class EmailSettingView(MasterView): emails = self.email_handler.get_available_emails() for key, Email in emails.items(): email = Email(self.rattail_config, key) - data.append(self.normalize(email)) + try: + normalized = self.normalize(email) + except: + log.warning("cannot normalize email: %s", email, + exc_info=True) + else: + data.append(normalized) return data def configure_grid(self, g):