Commit 91874e75 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Add script Event_sendByActivity to call searchAndActivate method through the...

Add script Event_sendByActivity to call searchAndActivate method through the activity and with Manager role
parent 0ce1e644
...@@ -115,12 +115,16 @@ if download or not use_activity:\n ...@@ -115,12 +115,16 @@ if download or not use_activity:\n
context.activate(activity=\'SQLQueue\').sendMailHostMessage(mail_message)\n context.activate(activity=\'SQLQueue\').sendMailHostMessage(mail_message)\n
\n \n
if use_activity:\n if use_activity:\n
uid_list = context.getDestinationUidList()\n destination_list = context.getDestinationValueList()\n
path_list = [x.getPath() for x in destination_list]\n
uid_list = [x.getUid() for x in destination_list]\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 attachment_list=attachment_list)\n
portal.portal_catalog.searchAndActivate(method_id="Entity_sendEmail",\n context.activate(\n
uid=uid_list,\n after_path_and_method_id=(path_list, \n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).Event_sendByActivity(\n
uid_list=uid_list,\n
method_kw=method_kw, **kw)\n method_kw=method_kw, **kw)\n
\n \n
# Transit event workflow\n # Transit event workflow\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id="Entity_sendEmail",\n
uid=uid_list,\n
method_kw=method_kw, **kw)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>uid_list, method_kw, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_sendByActivity</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
1024 1025
\ No newline at end of file \ No newline at end of file
...@@ -1634,6 +1634,8 @@ class TestCRMMailSend(BaseTestCRM): ...@@ -1634,6 +1634,8 @@ class TestCRMMailSend(BaseTestCRM):
mail_message.Event_send(packet_size=2) mail_message.Event_send(packet_size=2)
self.commit() self.commit()
portal_activities = self.portal.portal_activities portal_activities = self.portal.portal_activities
portal_activities.manageInvoke(object_path=mail_message.getPath(), method_id='Event_sendByActivity')
self.commit()
message_list = [i for i in portal_activities.getMessageList() \ message_list = [i for i in portal_activities.getMessageList() \
if i.kw.has_key("event_relative_url")] if i.kw.has_key("event_relative_url")]
try: try:
......
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