diff --git a/tailbone/views/email.py b/tailbone/views/email.py index 59737c08..a5687254 100644 --- a/tailbone/views/email.py +++ b/tailbone/views/email.py @@ -425,6 +425,9 @@ class EmailAttemptView(MasterView): def configure_form(self, f): super(EmailAttemptView, self).configure_form(f) + # key + f.set_renderer('key', self.render_email_key) + # status_code f.set_enum('status_code', self.enum.EMAIL_ATTEMPT) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index a42cca8e..873439c4 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -911,6 +911,20 @@ class MasterView(View): url = self.request.route_url('customers.view', uuid=customer.uuid) return tags.link_to(text, url) + def render_email_key(self, obj, field): + if hasattr(obj, field): + email_key = getattr(obj, field) + else: + email_key = obj[field] + if not email_key: + return + + if self.request.has_perm('emailprofiles.view'): + url = self.request.route_url('emailprofiles.view', key=email_key) + return tags.link_to(email_key, url) + + return email_key + def before_create_flush(self, obj, form): pass diff --git a/tailbone/views/reports.py b/tailbone/views/reports.py index 74cba68d..1322567d 100644 --- a/tailbone/views/reports.py +++ b/tailbone/views/reports.py @@ -652,18 +652,6 @@ class ProblemReportView(MasterView): f.set_renderer('email_key', self.render_email_key) f.set_renderer('email_recipients', self.render_email_recipients) - def render_email_key(self, report_info, field): - email_key = report_info[field] - if not email_key: - return - - if self.request.has_perm('emailprofiles.view'): - text = email_key - url = self.request.route_url('emailprofiles.view', key=email_key) - return tags.link_to(text, url) - - return email_key - def render_email_recipients(self, report_info, field): recips = report_info['email_recipients'] return ', '.join(recips)