mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Use PassThrough renderer
Implements and depends on: - [ ] https://github.com/alphagov/notifications-utils/pull/49
This commit is contained in:
@@ -9,6 +9,7 @@ from flask import (
|
||||
)
|
||||
from notifications_utils.recipients import allowed_to_send_to, first_column_heading
|
||||
from notifications_utils.template import Template
|
||||
from notifications_utils.renderers import PassThrough
|
||||
from app.clients.email.aws_ses import get_aws_responses
|
||||
from app import api_user, encryption, create_uuid, DATETIME_FORMAT, DATE_FORMAT, statsd_client
|
||||
from app.models import KEY_TYPE_TEAM
|
||||
@@ -243,7 +244,7 @@ def send_notification(notification_type):
|
||||
template_object = Template(
|
||||
template.__dict__,
|
||||
notification.get('personalisation', {}),
|
||||
renderer=lambda content: content
|
||||
renderer=PassThrough()
|
||||
)
|
||||
if template_object.missing_data:
|
||||
message = 'Missing personalisation: {}'.format(", ".join(template_object.missing_data))
|
||||
|
||||
@@ -24,6 +24,8 @@ from notifications_utils.recipients import (
|
||||
validate_and_format_phone_number
|
||||
)
|
||||
|
||||
from notifications_utils.renderers import PassThrough
|
||||
|
||||
from app import ma
|
||||
from app import models
|
||||
from app.dao.permissions_dao import permission_dao
|
||||
@@ -272,7 +274,11 @@ class NotificationStatusSchema(BaseSchema):
|
||||
@post_dump
|
||||
def handle_template_merge(self, in_data):
|
||||
from notifications_utils.template import Template
|
||||
template = Template(in_data['template'], in_data['personalisation'])
|
||||
template = Template(
|
||||
in_data['template'],
|
||||
in_data['personalisation'],
|
||||
renderer=PassThrough()
|
||||
)
|
||||
in_data['body'] = template.replaced
|
||||
if in_data['template']['template_type'] == 'email':
|
||||
in_data['subject'] = template.replaced_subject
|
||||
|
||||
Reference in New Issue
Block a user