From ef567210ffb0db25da1c322415430e0f5ca1d6bf Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 30 Jun 2017 15:18:03 +0100 Subject: [PATCH] Mutate dictionary instead of creating new one Stops the case where keyword arguments could conflict. --- app/main/views/notifications.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index 0c910d6e2..5779db9b5 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -115,16 +115,9 @@ def get_all_personalisation_from_notification(notification): notification['personalisation'] = {} if notification['template']['template_type'] == 'email': - return dict( - email_address=notification['to'], - **notification['personalisation'] - ) + notification['personalisation']['email_address'] = notification['to'] if notification['template']['template_type'] == 'sms': - return dict( - phone_number=notification['to'], - **notification['personalisation'] - ) + notification['personalisation']['phone_number'] = notification['to'] - if notification['template']['template_type'] == 'letter': - return notification['personalisation'] + return notification['personalisation']