diff --git a/tailbone/templates/settings/email/configure.mako b/tailbone/templates/settings/email/configure.mako
index f0e5d4d9..50a3d483 100644
--- a/tailbone/templates/settings/email/configure.mako
+++ b/tailbone/templates/settings/email/configure.mako
@@ -3,6 +3,24 @@
<%def name="form_content()">
+
General
+
+
+
+
+
+
+
+
+
+
+
Sending
diff --git a/tailbone/views/email.py b/tailbone/views/email.py
index 428e8484..9c3d2268 100644
--- a/tailbone/views/email.py
+++ b/tailbone/views/email.py
@@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
-# Copyright © 2010-2022 Lance Edgar
+# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@@ -24,13 +24,9 @@
Email Views
"""
-from __future__ import unicode_literals, absolute_import
-
import re
import warnings
-import six
-
from rattail import mail
from rattail.db import model
from rattail.config import parse_list
@@ -105,7 +101,7 @@ class EmailSettingView(MasterView):
emails = self.email_handler.get_all_emails()
else:
emails = self.email_handler.get_available_emails()
- for key, Email in six.iteritems(emails):
+ for key, Email in emails.items():
email = Email(self.rattail_config, key)
data.append(self.normalize(email))
return data
@@ -266,9 +262,9 @@ class EmailSettingView(MasterView):
app.save_setting(session, 'rattail.mail.{}.to'.format(key), (data['to'] or '').replace('\n', ', '))
app.save_setting(session, 'rattail.mail.{}.cc'.format(key), (data['cc'] or '').replace('\n', ', '))
app.save_setting(session, 'rattail.mail.{}.bcc'.format(key), (data['bcc'] or '').replace('\n', ', '))
- app.save_setting(session, 'rattail.mail.{}.enabled'.format(key), six.text_type(data['enabled']).lower())
+ app.save_setting(session, 'rattail.mail.{}.enabled'.format(key), str(data['enabled']).lower())
if self.has_perm('configure'):
- app.save_setting(session, 'rattail.mail.{}.hidden'.format(key), six.text_type(data['hidden']).lower())
+ app.save_setting(session, 'rattail.mail.{}.hidden'.format(key), str(data['hidden']).lower())
return data
def template_kwargs_view(self, **kwargs):
@@ -280,6 +276,12 @@ class EmailSettingView(MasterView):
config = self.rattail_config
return [
+ # general
+ {'section': 'rattail.mail',
+ 'option': 'handler'},
+ {'section': 'rattail.mail',
+ 'option': 'templates'},
+
# sending
{'section': 'rattail.mail',
'option': 'record_attempts',
@@ -289,6 +291,16 @@ class EmailSettingView(MasterView):
'type': bool},
]
+ def configure_get_context(self, *args, **kwargs):
+ context = super().configure_get_context(*args, **kwargs)
+
+ # prettify list of template paths
+ templates = self.rattail_config.parse_list(
+ context['simple_settings']['rattail.mail.templates'])
+ context['simple_settings']['rattail.mail.templates'] = ', '.join(templates)
+
+ return context
+
def toggle_hidden(self):
app = self.get_rattail_app()
data = self.request.json_body