Commit ba657ff6 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Improved usage of portal default properties for from email and to email. Some...

Improved usage of portal default properties for from email and to email. Some space added for better syntax.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19204 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 995cdc40
...@@ -165,7 +165,8 @@ class NotificationTool(BaseTool): ...@@ -165,7 +165,8 @@ class NotificationTool(BaseTool):
# Default Values # Default Values
portal = self.getPortalObject() portal = self.getPortalObject()
default_email = portal.email_from_address default_from_email = portal.email_from_address
default_to_email = portal.email_to_address
# Change all strings to object values # Change all strings to object values
if isinstance(sender, basestring): if isinstance(sender, basestring):
...@@ -179,7 +180,7 @@ class NotificationTool(BaseTool): ...@@ -179,7 +180,7 @@ class NotificationTool(BaseTool):
if not email_from_address: if not email_from_address:
# If we can not find a from address then # If we can not find a from address then
# we fallback to default values # we fallback to default values
email_from_address = default_email email_from_address = default_from_email
# To is a list - let us find all members # To is a list - let us find all members
if not isinstance(recipient, (list, tuple)): if not isinstance(recipient, (list, tuple)):
...@@ -191,10 +192,10 @@ class NotificationTool(BaseTool): ...@@ -191,10 +192,10 @@ class NotificationTool(BaseTool):
mailhost = getattr(self.getPortalObject(), 'MailHost', None) mailhost = getattr(self.getPortalObject(), 'MailHost', None)
if mailhost is None: if mailhost is None:
raise AttributeError, "Cannot find a MailHost object" raise AttributeError, "Cannot find a MailHost object"
mail_message = buildEmailMessage(email_from_address, default_email, mail_message = buildEmailMessage(email_from_address, default_to_email,
msg=message, subject=subject, msg=message, subject=subject,
attachment_list=attachment_list) attachment_list=attachment_list)
return mailhost.send(mail_message.as_string(), default_email, email_from_address) return mailhost.send(mail_message.as_string(), default_to_email, email_from_address)
# Default implementation is to send an active message to everyone # Default implementation is to send an active message to everyone
for person in recipient: for person in recipient:
......
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