Merge pull request #395 from sartography/email-format-489
Email format #489
This commit is contained in:
commit
dc07d42a9c
|
@ -66,11 +66,11 @@ class EmailService(object):
|
||||||
|
|
||||||
def get_rendered_content(self, message, data):
|
def get_rendered_content(self, message, data):
|
||||||
template = Template(message)
|
template = Template(message)
|
||||||
rendered = template.render(data)
|
content = template.render(data)
|
||||||
rendered_markdown = markdown.markdown(rendered)
|
rendered_markdown = markdown.markdown(content, extensions=['nl2br'])
|
||||||
wrapped = self.get_cr_connect_wrapper(rendered_markdown)
|
content_html = self.get_cr_connect_wrapper(rendered_markdown)
|
||||||
|
|
||||||
return rendered, wrapped
|
return content, content_html
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_cr_connect_wrapper(email_body):
|
def get_cr_connect_wrapper(email_body):
|
||||||
|
|
|
@ -17,7 +17,11 @@ New request submitted by {{ PIComputingID }}
|
||||||
|
|
||||||
Email content to be delivered to {{ ApprvlApprvr1 }}
|
Email content to be delivered to {{ ApprvlApprvr1 }}
|
||||||
|
|
||||||
---</bpmn:documentation>
|
---
|
||||||
|
**Test Some Formatting**
|
||||||
|
&ensp;_UVA Tracking Number:_ {{ 321 }}
|
||||||
|
|
||||||
|
</bpmn:documentation>
|
||||||
<bpmn:incoming>Flow_08n2npe</bpmn:incoming>
|
<bpmn:incoming>Flow_08n2npe</bpmn:incoming>
|
||||||
<bpmn:outgoing>Flow_1xlrgne</bpmn:outgoing>
|
<bpmn:outgoing>Flow_1xlrgne</bpmn:outgoing>
|
||||||
<bpmn:script>subject="Camunda Email Subject"
|
<bpmn:script>subject="Camunda Email Subject"
|
||||||
|
|
|
@ -29,6 +29,9 @@ class TestEmailScript(BaseTest):
|
||||||
self.assertIn(task_data['ApprvlApprvr1'], outbox[0].body)
|
self.assertIn(task_data['ApprvlApprvr1'], outbox[0].body)
|
||||||
self.assertIn(task_data['ApprvlApprvr1'], outbox[0].html)
|
self.assertIn(task_data['ApprvlApprvr1'], outbox[0].html)
|
||||||
|
|
||||||
|
# Test nl2br formatting
|
||||||
|
self.assertIn('<strong>Test Some Formatting</strong><br />', outbox[0].html)
|
||||||
|
|
||||||
# Correct From field
|
# Correct From field
|
||||||
self.assertEqual('uvacrconnect@virginia.edu', outbox[0].sender)
|
self.assertEqual('uvacrconnect@virginia.edu', outbox[0].sender)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue