Incorporate breaking utils changes

The `.replaced…` methods on instances of `Template` were removed in
https://github.com/alphagov/notifications-utils/pull/84
This commit is contained in:
Chris Hill-Scott
2016-12-02 10:26:03 +00:00
parent 9fb378021c
commit d449475dd5
7 changed files with 25 additions and 18 deletions

View File

@@ -15,6 +15,7 @@ from marshmallow import (
)
from marshmallow_sqlalchemy import field_for
from notifications_utils.field import Field
from notifications_utils.recipients import (
validate_email_address,
InvalidEmailError,
@@ -395,10 +396,10 @@ class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
in_data['personalisation'],
renderer=PassThrough()
)
in_data['body'] = template.replaced
in_data['body'] = template.rendered
template_type = in_data['template']['template_type']
if template_type == 'email':
in_data['subject'] = template.replaced_subject
in_data['subject'] = str(Field(template.subject, in_data['personalisation']))
in_data['content_char_count'] = None
else:
in_data['content_char_count'] = len(in_data['body'])