From 1152fba06715ad7bbd23370aa03c43ed94c56694 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 6 Aug 2022 22:57:10 -0500 Subject: [PATCH] Always show "all" email settings if user has config perm also tweak view config, per newer convention --- tailbone/views/email.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tailbone/views/email.py b/tailbone/views/email.py index b3135d6a..3798639a 100644 --- a/tailbone/views/email.py +++ b/tailbone/views/email.py @@ -100,7 +100,7 @@ class EmailSettingView(MasterView): def get_data(self, session=None): data = [] - if self.has_perm('configure') and self.email_handler.use_entry_points(): + if self.has_perm('configure'): emails = self.email_handler.get_all_emails() else: emails = self.email_handler.get_available_emails() @@ -525,7 +525,18 @@ class EmailAttemptView(MasterView): f.set_enum('status_code', self.enum.EMAIL_ATTEMPT) -def includeme(config): +def defaults(config, **kwargs): + base = globals() + + EmailSettingView = kwargs.get('EmailSettingView', base['EmailSettingView']) EmailSettingView.defaults(config) + + EmailPreview = kwargs.get('EmailPreview', base['EmailPreview']) EmailPreview.defaults(config) + + EmailAttemptView = kwargs.get('EmailAttemptView', base['EmailAttemptView']) EmailAttemptView.defaults(config) + + +def includeme(config): + defaults(config)