Log warning / avoid error if email profile can't be normalized

e.g. if some import error happens
This commit is contained in:
Lance Edgar 2023-10-29 22:22:16 -05:00
parent 8b07289452
commit a0075f6f78

View file

@ -24,6 +24,7 @@
Email Views Email Views
""" """
import logging
import re import re
import warnings import warnings
@ -41,6 +42,9 @@ from tailbone.db import Session
from tailbone.views import View, MasterView from tailbone.views import View, MasterView
log = logging.getLogger(__name__)
class EmailSettingView(MasterView): class EmailSettingView(MasterView):
""" """
Master view for email admin (settings/preview). Master view for email admin (settings/preview).
@ -103,7 +107,13 @@ class EmailSettingView(MasterView):
emails = self.email_handler.get_available_emails() emails = self.email_handler.get_available_emails()
for key, Email in emails.items(): for key, Email in emails.items():
email = Email(self.rattail_config, key) 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 return data
def configure_grid(self, g): def configure_grid(self, g):