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
"""
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):