mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Remove unused build_notification_message method
This commit is contained in:
parent
653ec0ffab
commit
9f4d65891c
@ -92,25 +92,6 @@ class NotificationTemplate(CommonModelNameNotUnique):
|
|||||||
def get_message(self, condition):
|
def get_message(self, condition):
|
||||||
return self.messages.get(condition, {})
|
return self.messages.get(condition, {})
|
||||||
|
|
||||||
def build_notification_message(self, event_type, context):
|
|
||||||
env = sandbox.ImmutableSandboxedEnvironment()
|
|
||||||
templates = self.get_message(event_type)
|
|
||||||
msg_template = templates.get('message', {})
|
|
||||||
|
|
||||||
try:
|
|
||||||
notification_subject = env.from_string(msg_template).render(**context)
|
|
||||||
except (TemplateSyntaxError, UndefinedError, SecurityError):
|
|
||||||
notification_subject = ''
|
|
||||||
|
|
||||||
|
|
||||||
msg_body = templates.get('body', {})
|
|
||||||
try:
|
|
||||||
notification_body = env.from_string(msg_body).render(**context)
|
|
||||||
except (TemplateSyntaxError, UndefinedError, SecurityError):
|
|
||||||
notification_body = ''
|
|
||||||
|
|
||||||
return (notification_subject, notification_body)
|
|
||||||
|
|
||||||
def get_absolute_url(self, request=None):
|
def get_absolute_url(self, request=None):
|
||||||
return reverse('api:notification_template_detail', kwargs={'pk': self.pk}, request=request)
|
return reverse('api:notification_template_detail', kwargs={'pk': self.pk}, request=request)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user