mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
only calculate excluded classes once
This commit is contained in:
parent
40ff2f61aa
commit
e95cc7c699
@ -91,6 +91,12 @@ class BulkNotificationMethod(NotificationMethod):
|
||||
raise NotImplementedError('The `send` method must be overriden!')
|
||||
|
||||
|
||||
IGNORED_NOTIFICATION_CLS = set([
|
||||
SingleNotificationMethod,
|
||||
BulkNotificationMethod,
|
||||
])
|
||||
|
||||
|
||||
class UIMessageNotification(SingleNotificationMethod):
|
||||
METHOD_NAME = 'ui_message'
|
||||
|
||||
@ -155,11 +161,7 @@ def trigger_notifaction(obj, category=None, obj_ref='pk', **kwargs):
|
||||
if delivery_methods is None:
|
||||
delivery_methods = inheritors(NotificationMethod)
|
||||
|
||||
ignored_classes = set([
|
||||
SingleNotificationMethod,
|
||||
BulkNotificationMethod,
|
||||
])
|
||||
for method in (delivery_methods - ignored_classes):
|
||||
for method in (delivery_methods - IGNORED_NOTIFICATION_CLS):
|
||||
logger.info(f"Triggering method '{method.METHOD_NAME}'")
|
||||
try:
|
||||
deliver_notification(method, obj, category, targets, context)
|
||||
|
Loading…
Reference in New Issue
Block a user