Commit e9675ba1 by Yusei Tahara

Support attachment_list.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20989 20353a03-c40f-0410-a6d1-a30d3c3de9de
1 parent b7f49893
......@@ -366,8 +366,7 @@ class EmailDocument(File, TextDocument):
security.declareProtected(Permissions.UseMailhostServices, 'send')
def send(self, from_url=None, to_url=None, reply_url=None, subject=None,
body=None,
attachment_format=None, download=False):
body=None, attachment_format=None, attachment_list=None, download=False):
"""
Sends the current event content by email. If documents are
attached through the aggregate category, enclose them.
......@@ -391,6 +390,10 @@ class EmailDocument(File, TextDocument):
use the text representation of the event
as body (UTF-8)
attachment_list -- list of dictionary which contains raw data and
name and mimetype for attachment.
See NotificationTool.buildEmailMessage.
attachment_format - defines an option format
to convet attachments to (ex. application/pdf)
......@@ -449,7 +452,8 @@ class EmailDocument(File, TextDocument):
to_url_list.append(to_url)
# Attachments
attachment_list = []
if attachment_list is None:
attachment_list = []
document_type_list = self.getPortalDocumentTypeList()
for attachment in self.getAggregateValueList():
mime_type = None
......
......@@ -102,7 +102,8 @@ class Event(EmailDocument, Movement):
security.declareProtected(Permissions.UseMailhostServices, 'send')
def send(self, from_url=None, to_url=None, reply_url=None, subject=None,
body=None, attachment_format=None, download=False, **kw):
body=None, attachment_format=None, attachment_list=None,
download=False, **kw):
"""
Make the send method overridable by typed based script
so that special kinds of events can use a different gateway
......@@ -115,8 +116,10 @@ class Event(EmailDocument, Movement):
send_script = self._getTypeBasedMethod('send')
if send_script is None:
return Event.inheritedAttribute('send')(
self, from_url, to_url, reply_url, subject, body, attachment_format, download
self, from_url, to_url, reply_url, subject, body, attachment_format,
attachment_list, download
)
return send_script(
from_url, to_url, reply_url, subject, body, attachment_format, download, **kw
from_url, to_url, reply_url, subject, body, attachment_format, attachment_list,
download, **kw
)
......@@ -221,7 +221,8 @@ class NotificationTool(BaseTool):
# high-level interface
security.declareProtected(Permissions.UseMailhostServices, 'sendMessage')
def sendMessage(self, sender=None, recipient=None, subject=None,
message=None, attachment_document_list=None,
message=None,
attachment_list=None, attachment_document_list=None,
notifier_list=None, priority_level=None,
store_as_event=False,
message_text_format='text/plain',
......@@ -243,6 +244,10 @@ class NotificationTool(BaseTool):
message -- the text of the message (already translated)
attachment_list -- list of dictionary which contains raw data and
name and mimetype for attachment.
See buildEmailMessage.
attachment_document_list -- list of document (optional)
which will be attachment.
......@@ -302,6 +307,8 @@ class NotificationTool(BaseTool):
low_level_kw['from_url'] = default_from_email
if not to_person_list:
low_level_kw['to_url'] = default_to_email
if attachment_list is not None:
low_level_kw['attachment_list'] = attachment_list
# Make event
available_notifier_list = self.getNotifierList()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!