From aaa9d47ccfdf0fa785018add943b25d89c52c124 Mon Sep 17 00:00:00 2001 From: richard-dds Date: Mon, 13 May 2019 11:40:54 -0400 Subject: [PATCH] Wire up NotificationSender to the app's error handler --- atst/routes/errors.py | 2 ++ atst/utils/notification_sender.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/atst/routes/errors.py b/atst/routes/errors.py index c129e08d..d6edc566 100644 --- a/atst/routes/errors.py +++ b/atst/routes/errors.py @@ -11,6 +11,7 @@ from atst.domain.invitations import ( from atst.domain.authnid.crl import CRLInvalidException from atst.domain.portfolios import PortfolioError from atst.utils.flash import formatted_flash as flash +from atst.utils.notification_sender import notification_sender def log_error(e): @@ -20,6 +21,7 @@ def log_error(e): def handle_error(e, message="Not Found", code=404): log_error(e) + notification_sender.send(message) return render_template("error.html", message=message), code diff --git a/atst/utils/notification_sender.py b/atst/utils/notification_sender.py index 0260993f..4b47f472 100644 --- a/atst/utils/notification_sender.py +++ b/atst/utils/notification_sender.py @@ -1,4 +1,4 @@ -from atst.queue import ATSTQueue +from atst.queue import ATSTQueue, queue from atst.database import db from atst.models import NotificationRecipient @@ -18,3 +18,6 @@ class NotificationSender(object): recipient.email for recipient in db.session.query(NotificationRecipient).all() ] + + +notification_sender = NotificationSender(queue)