Wire up NotificationSender to the app's error handler
This commit is contained in:
@@ -11,6 +11,7 @@ from atst.domain.invitations import (
|
|||||||
from atst.domain.authnid.crl import CRLInvalidException
|
from atst.domain.authnid.crl import CRLInvalidException
|
||||||
from atst.domain.portfolios import PortfolioError
|
from atst.domain.portfolios import PortfolioError
|
||||||
from atst.utils.flash import formatted_flash as flash
|
from atst.utils.flash import formatted_flash as flash
|
||||||
|
from atst.utils.notification_sender import notification_sender
|
||||||
|
|
||||||
|
|
||||||
def log_error(e):
|
def log_error(e):
|
||||||
@@ -20,6 +21,7 @@ def log_error(e):
|
|||||||
|
|
||||||
def handle_error(e, message="Not Found", code=404):
|
def handle_error(e, message="Not Found", code=404):
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
notification_sender.send(message)
|
||||||
return render_template("error.html", message=message), code
|
return render_template("error.html", message=message), code
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from atst.queue import ATSTQueue
|
from atst.queue import ATSTQueue, queue
|
||||||
from atst.database import db
|
from atst.database import db
|
||||||
from atst.models import NotificationRecipient
|
from atst.models import NotificationRecipient
|
||||||
|
|
||||||
@@ -18,3 +18,6 @@ class NotificationSender(object):
|
|||||||
recipient.email
|
recipient.email
|
||||||
for recipient in db.session.query(NotificationRecipient).all()
|
for recipient in db.session.query(NotificationRecipient).all()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
notification_sender = NotificationSender(queue)
|
||||||
|
Reference in New Issue
Block a user