Commit 6ba4a6b1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

base: do not store a generated email message payload in a Mail Message document.

that causes ZODB conflicts and it is meaningless in multiple destination case.
parent 1003939c
......@@ -50,9 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from email.utils import formataddr\n
<value> <string>from email.utils import formataddr\n
portal = context.getPortalObject()\n
event = portal.restrictedTraverse(event_relative_url)\n
\n
......@@ -83,24 +81,7 @@ mail_message = portal.Base_createMailMessageAsString(from_url,\n
embedded_file_list=embedded_file_list)\n
\n
event.sendMailHostMessage(mail_message)\n
\n
if not event.hasData() and len(event.getDestinationList()) == 1:\n
# Store the content of the email as data, so that we can keep a reference to\n
# the email that was actually sent.\n
# We do not store when there is more than one recipent.\n
if len(embedded_file_list):\n
# do not store aggregated documents in Email document\n
# to avoid duplicate data\n
mail_message = context.Base_createMailMessageAsString(from_url,\n
to_url,\n
subject,\n
body,\n
content_type,\n
attachment_list=attachment_list)\n
event.setData(mail_message)\n
]]></string> </value>
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......
......@@ -115,18 +115,6 @@ if download or not use_activity:\n
attachment_list=attachment_list,\n
embedded_file_list=embedded_file_list)\n
\n
if len(embedded_file_list):\n
# do not store aggregated documents in Email document\n
# to avoid duplicate data\n
tmp_mail_message = context.Base_createMailMessageAsString(from_url,\n
to_url,\n
subject,\n
body,\n
content_type,\n
attachment_list=attachment_list)\n
context.setData(tmp_mail_message)\n
else:\n
context.setData(mail_message)\n
if not use_activity:\n
context.activate(activity=\'SQLQueue\').sendMailHostMessage(mail_message)\n
\n
......
......@@ -1111,12 +1111,6 @@ class TestCRMMailSend(BaseTestCRM):
# content type is kept
self.assertEqual(event.getContentType(), 'text/html')
# The getTextContent() gets the content from the file data instead the
# Attribute text_content.
self.assertTrue(event.hasFile())
self.assertEqual(event.text_content, text_content)
text_content_from_data = '<html><body>Hello<br />World</body></html>'
self.assertEqual(event.getTextContent(), text_content_from_data)
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
mfrom, mto, messageText = last_message
......
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