From 0ddb5bffd74213ab37b201a7b0960fbf2452172b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 23 Jul 2015 15:47:17 -0500 Subject: [PATCH] Add plain text of message body to email bounce view. Also tweak some labels. --- tailbone/templates/emailbounces/crud.mako | 37 +++++++++++++++++++++++ tailbone/views/bouncer.py | 10 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/tailbone/templates/emailbounces/crud.mako b/tailbone/templates/emailbounces/crud.mako index 666c28d9..4433fbb0 100644 --- a/tailbone/templates/emailbounces/crud.mako +++ b/tailbone/templates/emailbounces/crud.mako @@ -11,4 +11,41 @@ % endif +<%def name="head_tags()"> + ${parent.head_tags()} + + + + ${parent.body()} + +
+${message}
+
diff --git a/tailbone/views/bouncer.py b/tailbone/views/bouncer.py index 1eb743ab..d5a1c684 100644 --- a/tailbone/views/bouncer.py +++ b/tailbone/views/bouncer.py @@ -158,19 +158,25 @@ class EmailBounceCrud(CrudView): fs.config_key.label("Source"), fs.message, fs.bounced, - fs.intended_recipient_address.label("Intended For"), fs.bounce_recipient_address.label("Bounced To"), + fs.intended_recipient_address.label("Intended For"), fs.links, fs.processed, fs.processed_by, ], readonly=True) + if not bounce.processed: + del fs.processed + del fs.processed_by return fs def template_kwargs(self, form): kwargs = super(EmailBounceCrud, self).template_kwargs(form) bounce = form.fieldset.model - kwargs['handler'] = self.get_handler(bounce) + handler = self.get_handler(bounce) + kwargs['handler'] = handler + with open(handler.msgpath(bounce), 'rb') as f: + kwargs['message'] = f.read() return kwargs def process(self):