From 068ecd80a1c932d1b4dbf5db6846e661278b9775 Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Thu, 5 Oct 2017 16:29:11 +0100 Subject: [PATCH] Changes after review. Style changes to ensure consistency with the rest of the code base to ensure good maintainability in future. --- app/dao/notifications_dao.py | 13 +++++++------ app/v2/notifications/post_notifications.py | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index ecdf314d2..4183c6f4c 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -28,8 +28,13 @@ from app.models import ( Notification, NotificationHistory, NotificationStatistics, - Template, + NotificationEmailReplyTo, + ServiceEmailReplyTo, ScheduledNotification, + Template, + KEY_TYPE_NORMAL, + KEY_TYPE_TEST, + LETTER_TYPE, NOTIFICATION_CREATED, NOTIFICATION_DELIVERED, NOTIFICATION_SENDING, @@ -37,11 +42,7 @@ from app.models import ( NOTIFICATION_TECHNICAL_FAILURE, NOTIFICATION_TEMPORARY_FAILURE, NOTIFICATION_PERMANENT_FAILURE, - KEY_TYPE_NORMAL, KEY_TYPE_TEST, - LETTER_TYPE, - NOTIFICATION_SENT, - NotificationEmailReplyTo, - ServiceEmailReplyTo + NOTIFICATION_SENT ) from app.dao.dao_utils import transactional diff --git a/app/v2/notifications/post_notifications.py b/app/v2/notifications/post_notifications.py index 43b277294..32b96cf8f 100644 --- a/app/v2/notifications/post_notifications.py +++ b/app/v2/notifications/post_notifications.py @@ -16,11 +16,11 @@ from app.models import ( ) from app.celery.tasks import update_letter_notifications_to_sent_to_dvla from app.notifications.process_notifications import ( + persist_email_reply_to_id_for_notification, persist_notification, - send_notification_to_queue, - simulated_recipient, persist_scheduled_notification, - persist_email_reply_to_id_for_notification + send_notification_to_queue, + simulated_recipient ) from app.notifications.process_letter_notifications import ( create_letter_notification @@ -143,7 +143,7 @@ def process_sms_or_email_notification(*, form, notification_type, api_key, templ ) email_reply_to_id = form.get("email_reply_to_id", None) - if email_reply_to_id is not None: + if email_reply_to_id: persist_email_reply_to_id_for_notification(notification.id, email_reply_to_id) scheduled_for = form.get("scheduled_for", None)