Commit f074b7c7 authored by Jérome Perrin's avatar Jérome Perrin

NotificationTool: raise an explicit error when user pass notifier_list as a string

With current implementation, when passing notifier_list="Mail Message",
the same email is sent len("Mail Message") times.
parent b0769165
...@@ -282,6 +282,14 @@ class NotificationTool(BaseTool): ...@@ -282,6 +282,14 @@ class NotificationTool(BaseTool):
catalog_tool = getToolByName(self, 'portal_catalog') catalog_tool = getToolByName(self, 'portal_catalog')
if portal_type_list is None: if portal_type_list is None:
portal_type_list = ('Person',) portal_type_list = ('Person',)
if notifier_list is None:
# XXX TODO: Use priority_level. Need to implement default notifier query system.
# XXX For now, we use 'Mail Message'.
notifier_list = ['Mail Message']
if not isinstance(notifier_list, (tuple, list)):
raise TypeError("Notifier list must be a list of portal types")
# Find "From" Person # Find "From" Person
from_person = None from_person = None
if isinstance(sender, basestring): if isinstance(sender, basestring):
...@@ -333,10 +341,6 @@ class NotificationTool(BaseTool): ...@@ -333,10 +341,6 @@ class NotificationTool(BaseTool):
# Make event # Make event
available_notifier_list = self.getNotifierList() available_notifier_list = self.getNotifierList()
event_list = [] event_list = []
if notifier_list is None:
# XXX TODO: Use priority_level. Need to implement default notifier query system.
# XXX For now, we use 'Mail Message'.
notifier_list = ['Mail Message']
if event_keyword_argument_dict is None: if event_keyword_argument_dict is None:
event_keyword_argument_dict = {} event_keyword_argument_dict = {}
for notifier in notifier_list: for notifier in notifier_list:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment