From 09f45332eb34339065d63fe2afff5a8ca9f4a879 Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Wed, 17 May 2017 13:25:40 +0100 Subject: [PATCH 1/2] Fixed issues caused by single evaluation of method signature defaults --- app/notifications/process_notifications.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/notifications/process_notifications.py b/app/notifications/process_notifications.py index 7a8cf9065..f791ab754 100644 --- a/app/notifications/process_notifications.py +++ b/app/notifications/process_notifications.py @@ -38,7 +38,7 @@ def persist_notification( notification_type, api_key_id, key_type, - created_at=datetime.utcnow(), + created_at, job_id=None, job_row_number=None, reference=None, @@ -47,6 +47,8 @@ def persist_notification( simulated=False ): + notification_created_at = created_at or datetime.utcnow() + notification = Notification( id=notification_id, template_id=template_id, @@ -58,7 +60,7 @@ def persist_notification( notification_type=notification_type, api_key_id=api_key_id, key_type=key_type, - created_at=created_at, + created_at=notification_created_at, job_id=job_id, job_row_number=job_row_number, client_reference=client_reference, @@ -81,7 +83,7 @@ def persist_notification( if redis_store.get_all_from_hash(cache_key_for_service_template_counter(service.id)): redis_store.increment_hash_value(cache_key_for_service_template_counter(service.id), template_id) current_app.logger.info( - "{} {} created at {}".format(notification_type, notification_id, created_at) + "{} {} created at {}".format(notification_type, notification_id, notification_created_at) ) return notification From ee5bb5f01a1258308ac3c7394ab519e6c93e04e9 Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Wed, 17 May 2017 13:27:05 +0100 Subject: [PATCH 2/2] Fixed issues caused by single evaluation of method signature defaults --- 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 f791ab754..1d03efe8b 100644 --- a/app/notifications/process_notifications.py +++ b/app/notifications/process_notifications.py @@ -38,7 +38,7 @@ def persist_notification( notification_type, api_key_id, key_type, - created_at, + created_at=None, job_id=None, job_row_number=None, reference=None,