Commit 367968ad authored by Yusei Tahara's avatar Yusei Tahara

2008-5-29 yusei

* Add type based method for Event.send and use MailTemplate to build mail message.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21221 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7f7d4938
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# Transit event workflow\n
context.plan()\n
context.order()\n
context.start()\n
\n
if body is None:\n
body = context.asText()\n
\n
# Subject\n
if subject is None:\n
subject = context.getTitle()\n
\n
# From\n
if from_url is None:\n
sender = context.getSourceValue()\n
if sender.getTitle():\n
from_url = \'"%s" <%s>\' % (sender.getTitle(),\n
sender.getDefaultEmailText())\n
else:\n
from_url = sender.getDefaultEmailText()\n
\n
# Return-Path\n
if reply_url is None:\n
reply_url = context.portal_preferences.getPreferredEventSenderEmail()\n
additional_headers = None\n
if reply_url:\n
additional_headers = {\'Return-Path\':reply_url}\n
\n
# To (multiple)\n
to_url_list = []\n
if to_url is None:\n
for recipient in context.getDestinationValueList():\n
email = recipient.getDefaultEmailText()\n
if email:\n
if recipient.getTitle():\n
to_url_list.append(\'"%s" <%s>\' % (recipient.getTitle(), email))\n
else:\n
to_url_list.append(email)\n
else:\n
raise ValueError, \'Recipient %s has no defined email\' % recipient\n
elif same_type(to_url, \'\'):\n
to_url_list.append(to_url)\n
\n
# Attachments\n
if attachment_list is None:\n
attachment_list = []\n
document_type_list = context.getPortalDocumentTypeList()\n
for attachment in context.getAggregateValueList():\n
mime_type, content = attachment.asMimeTypeAndContent()\n
name = attachment.getReference()\n
\n
attachment_list.append({\'mime_type\':mime_type,\n
\'content\':content,\n
\'name\':name})\n
\n
# Build message per destination\n
mail_message = None\n
Event_viewMimeMessage = context.Event_viewMimeMessage\n
for to_url in to_url_list:\n
multipart = Event_viewMimeMessage.as_message(mfrom=from_url,\n
mto=to_url,\n
subject=subject,\n
body=body,\n
encoding=\'utf-8\')\n
for attachment_dict in attachment_list:\n
multipart.add_file(data=attachment_dict[\'content\'],\n
content_type=attachment_dict[\'mime_type\'],\n
filename=attachment_dict[\'name\'])\n
mail_message = str(multipart)\n
context.activate(activity=\'SQLQueue\').sendMailHostMessage(mail_message)\n
\n
context.setData(mail_message)\n
\n
if download:\n
return mail_message\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>from_url=None, to_url=None, reply_url=None, subject=None, body=None, attachment_format=None, attachment_list=None, download=None, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>8</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>from_url</string>
<string>to_url</string>
<string>reply_url</string>
<string>subject</string>
<string>body</string>
<string>attachment_format</string>
<string>attachment_list</string>
<string>download</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>None</string>
<string>sender</string>
<string>additional_headers</string>
<string>to_url_list</string>
<string>_getiter_</string>
<string>recipient</string>
<string>email</string>
<string>ValueError</string>
<string>same_type</string>
<string>document_type_list</string>
<string>attachment</string>
<string>mime_type</string>
<string>content</string>
<string>name</string>
<string>mail_message</string>
<string>Event_viewMimeMessage</string>
<string>multipart</string>
<string>attachment_dict</string>
<string>_getitem_</string>
<string>str</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<none/>
<none/>
<none/>
<none/>
<none/>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_send</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="MailTemplate" module="Products.MailTemplates.MailTemplate"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<tal:body xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
><tal:x replace="options/body"/></tal:body>
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_viewMimeMessage</string> </value>
</item>
<item>
<key> <string>mailhost</string> </key>
<value> <string>MailHost</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2008-5-29 yusei
* Add type based method for Event.send and use MailTemplate to build mail message.
2008-5-29 yusei 2008-5-29 yusei
* Modifiy response transition in event_workflow, now it create a new event and send it to recepient immediately. * Modifiy response transition in event_workflow, now it create a new event and send it to recepient immediately.
* Add quotation option in acknowledge dialog. * Add quotation option in acknowledge dialog.
......
250 251
\ No newline at end of file \ No newline at end of file
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