Files
awx/awx/main/notifications/base.py
Matthew Jones c812e85f65 Change email notification formatting.
Instead of pretty printing the datastructure we'll now dump out the
result in json format with indent=4 for pretty viewing.
2016-06-22 11:52:49 -04:00

21 lines
917 B
Python

# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
import json
from django.utils.encoding import smart_text
from django.core.mail.backends.base import BaseEmailBackend
class TowerBaseEmailBackend(BaseEmailBackend):
def format_body(self, body):
if "body" in body:
body_actual = body['body']
else:
body_actual = smart_text("{} #{} had status {} on Ansible Tower, view details at {}\n\n".format(body['friendly_name'],
body['id'],
body['status'],
body['url']))
body_actual += json.dumps(body, indent=4)
return body_actual