From 5b3e77ba874ff36bb5f06e7db56a620c9f2fef62 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 23 Oct 2017 14:41:49 +0100 Subject: [PATCH] Make missing personalisation error consistent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In other places the text we use for this error message is "Missing personalisation: name, date, thing". See: - https://github.com/alphagov/notifications-api/blob/72b108b694c76a4559be04cb51c468be8db46c57/app/template/rest.py#L125 - https://github.com/alphagov/notifications-api/blob/717c0510a3986123497d0e49dd52ae3f87d953d3/app/notifications/rest.py#L206 - https://github.com/alphagov/notifications-api/blob/05a179c6efb051de1ea70bd560d7cb6966c44ff6/app/v2/template/post_template.py#L38 For some reason this part of the codebase says "Template missing personalisation: …". This is inconsistent, and also confusing because it’s the API call that’s missing the personalisation, not the template itself. This commit changes the error message to be consistent with the majority of the codebase, which uses the less confusing wording. --- app/notifications/process_notifications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/notifications/process_notifications.py b/app/notifications/process_notifications.py index 2b8992ba1..21fda224e 100644 --- a/app/notifications/process_notifications.py +++ b/app/notifications/process_notifications.py @@ -31,7 +31,7 @@ def create_content_for_notification(template, personalisation): def check_placeholders(template_object): if template_object.missing_data: - message = 'Template missing personalisation: {}'.format(", ".join(template_object.missing_data)) + message = 'Missing personalisation: {}'.format(", ".join(template_object.missing_data)) raise BadRequestError(fields=[{'template': message}], message=message)