Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
8f165c65
Commit
8f165c65
authored
Oct 30, 2015
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! base: do not store a generated email message payload in a Mail Message document.
parent
6ba4a6b1
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
18 deletions
+43
-18
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml
...nTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml
+0
-3
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/MailMessage_send.xml
...nTemplateItem/portal_skins/erp5_base/MailMessage_send.xml
+24
-11
bt5/erp5_crm/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
...eAllowedContentTypeTemplateItem/allowed_content_types.xml
+3
-0
bt5/erp5_crm/bt/template_portal_type_allowed_content_type_list
...rp5_crm/bt/template_portal_type_allowed_content_type_list
+1
-0
product/ERP5/Document/EmailDocument.py
product/ERP5/Document/EmailDocument.py
+14
-1
product/ERP5/tests/testNotificationTool.py
product/ERP5/tests/testNotificationTool.py
+0
-2
product/ERP5Type/patches/MailTemplates.py
product/ERP5Type/patches/MailTemplates.py
+1
-1
No files found.
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml
View file @
8f165c65
...
@@ -64,8 +64,6 @@ elif sender is not None:\n
...
@@ -64,8 +64,6 @@ elif sender is not None:\n
else:\n
else:\n
from_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
from_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
\n
\n
attachment_list = kw.pop(\'attachment_list\', [])\n
\n
to_url = formataddr((context.getTitle(), context.getDefaultEmailText()))\n
to_url = formataddr((context.getTitle(), context.getDefaultEmailText()))\n
\n
\n
document_type_list = list(event.getPortalEmbeddedDocumentTypeList()) + list(event.getPortalDocumentTypeList())\n
document_type_list = list(event.getPortalEmbeddedDocumentTypeList()) + list(event.getPortalDocumentTypeList())\n
...
@@ -77,7 +75,6 @@ mail_message = portal.Base_createMailMessageAsString(from_url,\n
...
@@ -77,7 +75,6 @@ mail_message = portal.Base_createMailMessageAsString(from_url,\n
subject,\n
subject,\n
body,\n
body,\n
content_type,\n
content_type,\n
attachment_list=attachment_list,\n
embedded_file_list=embedded_file_list)\n
embedded_file_list=embedded_file_list)\n
\n
\n
event.sendMailHostMessage(mail_message)\n
event.sendMailHostMessage(mail_message)\n
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/MailMessage_send.xml
View file @
8f165c65
...
@@ -58,12 +58,28 @@ This script is also used by notification tool, that\'s why it is in erp5_base.\n
...
@@ -58,12 +58,28 @@ This script is also used by notification tool, that\'s why it is in erp5_base.\n
from email.utils import formataddr\n
from email.utils import formataddr\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
if attachment_list is None:\n
attachment_list = []\n
use_activity = False\n
use_activity = False\n
mail_message = None\n
mail_message = None\n
to_url_list = []\n
to_url_list = []\n
\n
\n
# Attachments\n
document_type_list = list(context.getPortalEmbeddedDocumentTypeList()) + list(context.getPortalDocumentTypeList())\n
embedded_file_list = context.getAggregateValueList(portal_type=document_type_list)\n
for attachment in attachment_list or []:\n
embedded_file = context.newContent(\n
portal_type=\'Embedded File\',\n
title=attachment[\'name\'],\n
filename=attachment[\'name\'],\n
content_type=attachment[\'mime_type\'],\n
data=attachment[\'content\'],\n
)\n
if embedded_file not in embedded_file_list:\n
embedded_file_list.append(embedded_file)\n
aggregate_list = context.getAggregateValueList()\n
context.setAggregateValueList(\n
aggregate_list + [x for x in embedded_file_list if x not in aggregate_list]\n
)\n
\n
if not context.isTempDocument() and to_url is None:\n
if not context.isTempDocument() and to_url is None:\n
use_activity = True\n
use_activity = True\n
\n
\n
...
@@ -79,10 +95,13 @@ if to_url is None:\n
...
@@ -79,10 +95,13 @@ if to_url is None:\n
else:\n
else:\n
to_url_list.append(to_url)\n
to_url_list.append(to_url)\n
\n
\n
if not context.hasStartDate():\n
context.setStartDate(DateTime())\n
\n
if download or not use_activity:\n
if download or not use_activity:\n
for to_url in to_url_list:\n
for to_url in to_url_list:\n
body = body or context.getTextContent()\n
body = body or context.getTextContent()
or \'\'
\n
subject = subject or context.getTitle()\n
subject = subject or context.getTitle()
or \'\'
\n
\n
\n
# From\n
# From\n
if from_url is None:\n
if from_url is None:\n
...
@@ -100,10 +119,6 @@ if download or not use_activity:\n
...
@@ -100,10 +119,6 @@ if download or not use_activity:\n
additional_headers = None\n
additional_headers = None\n
if reply_url:\n
if reply_url:\n
additional_headers = {\'Return-Path\':reply_url}\n
additional_headers = {\'Return-Path\':reply_url}\n
\n
# Attachments\n
document_type_list = list(context.getPortalEmbeddedDocumentTypeList()) + list(context.getPortalDocumentTypeList())\n
embedded_file_list = context.getAggregateValueList(portal_type=document_type_list)\n
\n
\n
content_type = context.getContentType()\n
content_type = context.getContentType()\n
\n
\n
...
@@ -112,7 +127,6 @@ if download or not use_activity:\n
...
@@ -112,7 +127,6 @@ if download or not use_activity:\n
subject,\n
subject,\n
body,\n
body,\n
content_type,\n
content_type,\n
attachment_list=attachment_list,\n
embedded_file_list=embedded_file_list)\n
embedded_file_list=embedded_file_list)\n
\n
\n
if not use_activity:\n
if not use_activity:\n
...
@@ -120,8 +134,7 @@ if download or not use_activity:\n
...
@@ -120,8 +134,7 @@ if download or not use_activity:\n
\n
\n
if use_activity:\n
if use_activity:\n
method_kw = dict(event_relative_url=context.getRelativeUrl(),\n
method_kw = dict(event_relative_url=context.getRelativeUrl(),\n
from_url=from_url,\n
from_url=from_url)\n
attachment_list=attachment_list)\n
context.activate(\n
context.activate(\n
after_path_and_method_id=((context.getPath(),), \n
after_path_and_method_id=((context.getPath(),), \n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).MailMessage_sendByActivity(\n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).MailMessage_sendByActivity(\n
...
...
bt5/erp5_crm/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
View file @
8f165c65
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
<item>
Visit
</item>
<item>
Visit
</item>
<item>
Web Message
</item>
<item>
Web Message
</item>
</portal_type>
</portal_type>
<portal_type
id=
"Mail Message"
>
<item>
Embedded File
</item>
</portal_type>
<portal_type
id=
"Meeting"
>
<portal_type
id=
"Meeting"
>
<item>
Event Path
</item>
<item>
Event Path
</item>
</portal_type>
</portal_type>
...
...
bt5/erp5_crm/bt/template_portal_type_allowed_content_type_list
View file @
8f165c65
...
@@ -11,6 +11,7 @@ Event Module | Short Message
...
@@ -11,6 +11,7 @@ Event Module | Short Message
Event Module | Site Message
Event Module | Site Message
Event Module | Visit
Event Module | Visit
Event Module | Web Message
Event Module | Web Message
Mail Message | Embedded File
Meeting Module | Meeting
Meeting Module | Meeting
Meeting | Event Path
Meeting | Event Path
Preference | Support Request
Preference | Support Request
...
...
product/ERP5/Document/EmailDocument.py
View file @
8f165c65
...
@@ -160,9 +160,22 @@ class EmailDocument(TextDocument):
...
@@ -160,9 +160,22 @@ class EmailDocument(TextDocument):
# Mail processing API
# Mail processing API
def
_getMessage
(
self
):
def
_getMessage
(
self
):
# Email Document is not a representation of SMTP payload, thus we no longer
# store it in 'data' property.
result
=
getattr
(
self
,
'_v_message'
,
None
)
result
=
getattr
(
self
,
'_v_message'
,
None
)
if
result
is
None
:
if
result
is
None
:
result
=
message_from_string
(
str
(
self
.
getData
()))
data
=
self
.
getData
()
if
not
data
:
# Generated a mail message temporarily to provide backward compatibility.
data
=
self
.
Base_createMailMessageAsString
(
from_url
=
'from@example.com'
,
to_url
=
'to@example.com'
,
subject
=
self
.
getTitle
()
or
''
,
body
=
self
.
getTextContent
()
or
''
,
content_type
=
self
.
getContentType
(),
embedded_file_list
=
self
.
getAggregateValueList
(),
)
result
=
message_from_string
(
data
)
self
.
_v_message
=
result
self
.
_v_message
=
result
return
result
return
result
...
...
product/ERP5/tests/testNotificationTool.py
View file @
8f165c65
...
@@ -525,8 +525,6 @@ class TestNotificationToolWithCRM(TestNotificationTool):
...
@@ -525,8 +525,6 @@ class TestNotificationToolWithCRM(TestNotificationTool):
self
.
assertEqual
(
1
,
len
(
event_list
))
self
.
assertEqual
(
1
,
len
(
event_list
))
event
=
event_list
[
0
]
event
=
event_list
[
0
]
self
.
assertEqual
(
mail_dict
[
'headers'
][
'message-id'
],
event
.
getSourceReference
())
self
.
assertEqual
(
'Mail Message'
,
event
.
getPortalTypeName
())
self
.
assertEqual
(
'Mail Message'
,
event
.
getPortalTypeName
())
self
.
assertEqual
(
'Subject'
,
event
.
getTitle
())
self
.
assertEqual
(
'Subject'
,
event
.
getTitle
())
self
.
assertEqual
(
'Message'
,
event
.
getTextContent
())
self
.
assertEqual
(
'Message'
,
event
.
getTextContent
())
...
...
product/ERP5Type/patches/MailTemplates.py
View file @
8f165c65
...
@@ -71,7 +71,7 @@ if BaseMailTemplate is not None:
...
@@ -71,7 +71,7 @@ if BaseMailTemplate is not None:
headers
[
header
]
=
value
headers
[
header
]
=
value
# check required values have been supplied
# check required values have been supplied
errors
=
[]
errors
=
[]
for
param
in
(
'mfrom'
,
'mto'
,
'subject'
):
for
param
in
(
'mfrom'
,
'mto'
):
if
not
values
.
get
(
param
):
if
not
values
.
get
(
param
):
errors
.
append
(
param
)
errors
.
append
(
param
)
if
errors
:
if
errors
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment