Commit 351db95e authored by Aurel's avatar Aurel

Merge remote-tracking branch 'origin/master' into test_page

parents 8f228bbb 65eac5c1
......@@ -59,11 +59,11 @@ body = event.getTextContent()\n
sender = event.getSourceValue()\n
if kw.get("from_url") is not None:\n
from_url = kw.get("from_url")\n
elif event.getSource() is not None:\n
sender = event.getSourceValue()\n
elif sender is not None:\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
else:\n
from_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
\n
attachment_list = kw.pop(\'attachment_list\', [])\n
\n
to_url = formataddr((context.getTitle(), context.getDefaultEmailText()))\n
......@@ -72,7 +72,7 @@ document_type_list = list(event.getPortalEmbeddedDocumentTypeList()) + list(even
embedded_file_list = event.getAggregateValueList(portal_type=document_type_list)\n
\n
content_type = event.getContentType()\n
mail_message = context.Base_createMailMessageAsString(from_url,\n
mail_message = portal.Base_createMailMessageAsString(from_url,\n
to_url,\n
subject,\n
body,\n
......@@ -83,6 +83,9 @@ mail_message = context.Base_createMailMessageAsString(from_url,\n
event.sendMailHostMessage(mail_message)\n
\n
if not event.hasData():\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
# XXX this has no meaning in the case of an email with multiple recipents.\n
if len(embedded_file_list):\n
# do not store aggregated documents in Email document\n
# to avoid duplicate data\n
......
......@@ -50,102 +50,10 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from email.utils import formataddr\n
from email import message_from_string\n
portal = context.getPortalObject()\n
\n
if attachment_list is None:\n
attachment_list = []\n
use_activity = False\n
mail_message = None\n
to_url_list = []\n
\n
if not context.isTempDocument() and to_url is None:\n
use_activity = True\n
\n
if to_url is None:\n
if use_activity:\n
recipient = context.getDestinationValue()\n
to_url_list.append(formataddr((recipient.getTitle(), recipient.getDefaultEmailText())))\n
else:\n
to_email_list = []\n
for recipient in context.getDestinationValueList():\n
email = recipient.getDefaultEmailText()\n
if email:\n
to_email_list.append(email)\n
to_url_list.append(formataddr((recipient.getTitle(), recipient.getDefaultEmailText())))\n
else:\n
raise ValueError("One email must be set to %s" % recipient.getRelativeUrl())\n
else:\n
to_url_list.append(to_url)\n
\n
if download or not use_activity:\n
for to_url in to_url_list:\n
body = body or context.getTextContent()\n
subject = subject or context.getTitle()\n
\n
# From\n
if from_url is None:\n
sender = context.getSourceValue()\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
\n
# Return-Path\n
if reply_url is None:\n
reply_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
additional_headers = None\n
if 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
content_type = context.getContentType()\n
\n
mail_message = context.Base_createMailMessageAsString(from_url, \n
to_url,\n
subject,\n
body,\n
content_type,\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
if use_activity:\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
from_url=from_url,\n
attachment_list=attachment_list)\n
context.activate(\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
\n
# Transit event workflow\n
if context.getTypeInfo() is not None:\n
for transition_id in \'plan\', \'order\', \'start\':\n
if portal.portal_workflow.isTransitionPossible(context, transition_id):\n
getattr(context, transition_id)()\n
\n
if download:\n
return mail_message\n
<value> <string>"""Event send does nothing by default, it has to be implemented for each kind\n
of event, look at MailMessage_send for example.\n
"""\n
pass\n
</string> </value>
</item>
<item>
......
<?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>"""Send a mail message.\n
\n
This script is also used by notification tool, that\'s why it is in erp5_base.\n
"""\n
\n
from email.utils import formataddr\n
portal = context.getPortalObject()\n
\n
if attachment_list is None:\n
attachment_list = []\n
use_activity = False\n
mail_message = None\n
to_url_list = []\n
\n
if not context.isTempDocument() and to_url is None:\n
use_activity = True\n
\n
if to_url is None:\n
for recipient in context.getDestinationValueList():\n
email = recipient.getDefaultEmailText()\n
if email:\n
to_url_list.append(formataddr((recipient.getTitle(), recipient.getDefaultEmailText())))\n
else:\n
# MailMessage portal type is supposed to have a constraint to report this\n
# to the user earlier\n
raise ValueError("One email must be set to %s" % recipient.getRelativeUrl())\n
else:\n
to_url_list.append(to_url)\n
\n
if download or not use_activity:\n
for to_url in to_url_list:\n
body = body or context.getTextContent()\n
subject = subject or context.getTitle()\n
\n
# From\n
if from_url is None:\n
sender = context.getSourceValue()\n
if sender is not None:\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
else:\n
from_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
if not from_url:\n
raise ValueError(\'Preferred Event Sender Email not configured\')\n
\n
# Return-Path\n
if reply_url is None:\n
reply_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
additional_headers = None\n
if 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
content_type = context.getContentType()\n
\n
mail_message = context.Base_createMailMessageAsString(from_url, \n
to_url,\n
subject,\n
body,\n
content_type,\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
if use_activity:\n
method_kw = dict(event_relative_url=context.getRelativeUrl(),\n
from_url=from_url,\n
attachment_list=attachment_list)\n
context.activate(\n
after_path_and_method_id=((context.getPath(),), \n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).MailMessage_sendByActivity(\n
method_kw=method_kw, **kw)\n
\n
if download:\n
return mail_message\n
</string> </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>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>MailMessage_send</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -52,13 +52,13 @@
<key> <string>_body</string> </key>
<value> <string>context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id="Entity_sendEmail",\n
uid=uid_list,\n
destination_related_uid=context.getUid(),\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>
<value> <string>method_kw, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -70,7 +70,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_sendByActivity</string> </value>
<value> <string>MailMessage_sendByActivity</string> </value>
</item>
</dictionary>
</pickle>
......
1054
\ No newline at end of file
1059
\ No newline at end of file
......@@ -587,7 +587,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
rule_list = self.portal.portal_rules.searchFolder(
reference=rule_template.getReference(),
title=rule_template.getTitle(),
validation_stade="validated")
validation_state="validated")
self.assertTrue(len(rule_list) > 0)
self.assertEquals(int(rule_template.getVersion(0)) + 1,
......
......@@ -58,7 +58,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create Events from Event Path</string> </value>
<value> <string>Create Events of Communication Plan</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Campaign_viewMassEmailingReportDialog</string> </value>
<value> <string>string:${object_url}/Ticket_viewMassEmailingReportDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -2,45 +2,78 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="VariableDefinition" module="Products.DCWorkflow.Variables"/>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>action</string> </key>
<value>
<none/>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_value</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>for_catalog</string> </key>
<value> <int>0</int> </value>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>for_status</string> </key>
<value> <int>1</int> </value>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>send_mail</string> </value>
<value> <string>view_communication_plan</string> </value>
</item>
<item>
<key> <string>info_guard</string> </key>
<key> <string>permissions</string> </key>
<value>
<none/>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Communication Plan</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Ticket_viewCommunicationPlan</string> </value>
</item>
</dictionary>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>create_event_from_event_path</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>10.5</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create Events of Communication Plan</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Ticket_viewCreateEventFromEventPathDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: object.getDefaultEventPath() is not None</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_report</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_report</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mass_emailing_report</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Mass Emailing Report</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Ticket_viewMassEmailingReportDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_communication_plan</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Communication Plan</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Ticket_viewCommunicationPlan</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -18,6 +18,9 @@
<item>Visit</item>
<item>Web Message</item>
</portal_type>
<portal_type id="Meeting">
<item>Event Path</item>
</portal_type>
<portal_type id="Meeting Module">
<item>Meeting</item>
</portal_type>
......
......@@ -6,6 +6,9 @@
<portal_type id="Event Module">
<item>Acknowledgement</item>
</portal_type>
<portal_type id="Meeting">
<item>Event Path</item>
</portal_type>
<portal_type id="Preference">
<item>Support Request</item>
</portal_type>
......
......@@ -6,6 +6,9 @@
<portal_type id="Event Path">
<item>EventPath</item>
</portal_type>
<portal_type id="Meeting">
<item>DefaultEventPath</item>
</portal_type>
<portal_type id="Support Request">
<item>Codification</item>
</portal_type>
......
......@@ -12,7 +12,9 @@
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
......@@ -48,12 +50,30 @@
</item>
<item>
<key> <string>permission</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>Ticket</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -94,10 +94,7 @@
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_default_event_path_event_portal_type</string>
<string>my_default_event_path_source_title</string>
</list>
<list/>
</value>
</item>
<item>
......@@ -113,10 +110,7 @@
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>my_default_event_path_resource_title</string>
<string>my_default_event_path_destination_title</string>
</list>
<list/>
</value>
</item>
<item>
......
......@@ -63,8 +63,9 @@ content_dict[\'destination_list\'] = content_dict.get(\'destination_list\', [])
content_dict[\'source_list\'] = content_dict.get(\'source_list\', []) + \\\n
[x.getRelativeUrl() for x in context.getSourceValueList() \\\n
if x.getRelativeUrl() not in content_dict.get(\'source_list\', [])]\n
\n
context.edit(**content_dict)\n
# reset reference\n
context.Event_generateReference()\n
</string> </value>
</item>
<item>
......
......@@ -74,8 +74,7 @@ if response_event_notification_message:\n
\n
message = portal.Base_translateString(\'Response Created.\')\n
if response_workflow_action == \'send\':\n
# use doActionFor to initialise workflow variable\n
portal.portal_workflow.doActionFor(response, \'start_action\', send_mail=True)\n
response.start()\n
return context.Base_redirect(form_id, keep_items={\'portal_status_message\': message})\n
elif response_workflow_action == \'plan\':\n
response.plan()\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>"""Owner Proxy Role allows anonymous users to create events\n
through web sites. cf. Event_init\n
"""\n
portal = context.getPortalObject()\n
type_definition = context.getTypeInfo()\n
\n
short_portal_type = type_definition.getShortTitle()\n
if not short_portal_type:\n
short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n
\n
new_id = portal.portal_ids.generateNewId(id_group=repr((\'reference\', short_portal_type)), default=1)\n
reference = \'%s-%s\' % (short_portal_type, new_id)\n
\n
context.setReference(reference)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_generateReference</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -71,8 +71,8 @@ def getEntityList(text):\n
for entity in Base_getEntityListFromFromHeader(text)]\n
\n
content_information = context.getContentInformation()\n
sender_list = getEntityList(content_information.get(\'From\', \'\'))\n
to_list = getEntityList(content_information.get(\'To\', \'\'))\n
sender_list = context.getSourceList() or getEntityList(content_information.get(\'From\', \'\'))\n
to_list = context.getDestinationList() or getEntityList(content_information.get(\'To\', \'\'))\n
cc_list = getEntityList(content_information.get(\'CC\', \'\'))\n
\n
# Build references\n
......
......@@ -52,23 +52,11 @@
<key> <string>_body</string> </key>
<value> <string>"""Owner Proxy Role allows anonymous users to create events\n
through web sites.\n
\n
Reference will be probably generated with dedicated tool\n
in near future\n
"""\n
portal = context.getPortalObject()\n
type_definition = context.getTypeInfo()\n
\n
short_portal_type = type_definition.getShortTitle()\n
if not short_portal_type:\n
short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n
\n
new_id = portal.portal_ids.generateNewId(id_group=repr((\'reference\', short_portal_type)), default=1)\n
reference = \'%s-%s\' % (short_portal_type, new_id)\n
\n
# Set preferred text format and reference\n
context.setContentType(context.portal_preferences.getPreferredTextFormat())\n
context.setReference(reference)\n
context.setContentType(portal.portal_preferences.getPreferredTextFormat())\n
context.Event_generateReference()\n
</string> </value>
</item>
<item>
......
......@@ -96,7 +96,6 @@
<string>your_comment</string>
<string>your_workflow_action</string>
<string>your_warning_message</string>
<string>your_send_mail</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_send_mail</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>invisible</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>When checked, this Mail Message will actually be sent to each recipient.</string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Send Mail</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getPortalType() in (\'Mail Message\', )</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -37,21 +37,7 @@
<value> <unicode encoding="cdata"><![CDATA[
<div tal:condition="python: context.getPortalType() == \'Mail Message\'" class="error" i18n:translate="" i18n:domain="erp5_ui">\n
<h2>Warning</h2>An email will be sent to <span i18n:name="mto" tal:replace="python: \', \'.join([recipient.getDefaultEmailText() for recipient in context.getDestinationValueList()])"/>\n
</div>\n
\n
<!-- XXX merge note: below this line is project specific -->\n
<div tal:condition="python: context.getPortalType() == \'Letter\'" class="error" i18n:translate="" i18n:domain="erp5_ui">\n
<h2>Warning</h2>An email with attached Letter will be sent to <span i18n:name="mto" tal:replace="python: \', \'.join([recipient.getDefaultEmailText() for recipient in context.getDestinationValueList()])"/>\n
</div>\n
\n
<div tal:condition="python: context.getPortalType() == \'Short Message\' and context.getResource().startswith(\'resource/event\')" class="error" i18n:translate="" i18n:domain="erp5_ui">\n
<h2>Warning</h2>An sms will be sent to <span i18n:name="mto" tal:replace="python: \', \'.join([recipient.getTitle() for recipient in context.getDestinationValueList()])"/>\n
</div>\n
\n
<div tal:condition="python: context.getPortalType() == \'Short Message\' and not context.getResource().startswith(\'resource/event\')" i18n:translate="" i18n:domain="erp5_ui">\n
No sms will be sent.<br />\n
Only message with resource <span i18n:name="resource" tal:replace="python: \', \'.join([cat.getTranslatedTitle() for cat in context.portal_categories.resource.event.objectValues()])"/> are sent.\n
<h2>Warning</h2>An email will be sent to <span i18n:name="mto" tal:replace="python: \', \'.join([recipient.getDefaultEmailText() or \'\' for recipient in context.getDestinationValueList()])"/>\n
</div>
]]></unicode> </value>
......
......@@ -50,7 +50,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
<value> <string encoding="cdata"><![CDATA[
portal = context.getPortalObject()\n
\n
count = portal.portal_catalog.countResults\n
\n
......@@ -63,14 +65,18 @@ total_opened = count(follow_up_uid=context.getUid(), \n
total_read = count(follow_up_uid=context.getUid(), \n
portal_type="Mail Message", simulation_state="delivered")[0][0]\n
\n
line = context.newContent(temp_object=1, total_event_sent=total_events, \n
total_event_received=total_opened, \n
total_event_received_percent=float(total_opened)/float(total_events)*100, \n
total_event_delivered=total_read,\n
total_event_delivered_percent=float(total_read)/float(total_events)*100)\n
\n
return line,\n
</string> </value>
if total_events > 0:\n
line = context.newContent(temp_object=1, total_event_sent=total_events, \n
total_event_received=total_opened, \n
total_event_received_percent=float(total_opened)/float(total_events)*100, \n
total_event_delivered=total_read,\n
total_event_delivered_percent=float(total_read)/float(total_events)*100)\n
return line,\n
else:\n
return []\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......@@ -86,7 +92,7 @@ return line,\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Campaign_getMassEmailingEventReportLineList</string> </value>
<value> <string>Ticket_getMassEmailingEventReportLineList</string> </value>
</item>
</dictionary>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_default_event_path_event_portal_type</string>
<string>my_default_event_path_source_title</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>my_default_event_path_resource_title</string>
<string>my_default_event_path_destination_title</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Ticket_viewCommunicationPlan</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Ticket_viewCommunicationPlan</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Communication Plan</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -108,7 +108,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Campaign_viewMassEmailingReport</string> </value>
<value> <string>Ticket_viewMassEmailingReport</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -116,7 +116,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Campaign_viewNewsletterReport</string> </value>
<value> <string>Ticket_viewNewsletterReport</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -79,7 +79,7 @@
<list>
<tuple>
<string>total_event_sent</string>
<string>Number of events sent</string>
<string>Number of Events Sent</string>
</tuple>
<tuple>
<string>total_event_received</string>
......@@ -136,7 +136,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>Campaign_getMassEmailingEventReportLineList</string> </value>
<value> <string>Ticket_getMassEmailingEventReportLineList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -29,7 +29,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Campaign_viewMassEmailingReport</string> </value>
<value> <string>Ticket_viewMassEmailingReport</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -100,7 +100,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Campaign_viewMassEmailingReportDialog</string> </value>
<value> <string>Ticket_viewMassEmailingReportDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -108,7 +108,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Campaign_viewMassEmailingReportDialog</string> </value>
<value> <string>Ticket_viewMassEmailingReportDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -51,16 +51,21 @@
<item>
<key> <string>_body</string> </key>
<value> <string>event = state_change[\'object\']\n
portal = event.getPortalObject()\n
send_mail = portal.portal_workflow.getInfoFor(event, \'send_mail\')\n
if send_mail and event.getPortalType() in (\'Mail Message\', ):\n
if event.getSource():\n
event.send()\n
else:\n
sender_email = portal.portal_preferences.getPreferredEventSenderEmail()\n
if not sender_email:\n
raise NotImplementedError(\'Preferred Event Sender Email not configured\')\n
event.send(from_url=portal.portal_preferences.getPreferredEventSenderEmail())\n
\n
send_method = event.getTypeBasedMethod(\'send\')\n
parameter_list = (\'from_url\', \'to_url\', \'reply_url\', \'subject\',\n
\'body\', \'attachment_format\', \'attachment_list\',)\n
if getattr(send_method, \'meta_type\', None) == \'Script (Python)\':\n
parameter_list = send_method.ZScriptHTML_tryParams()\n
\n
# Turn the SafeMapping from keyword arguments into a dict.\n
kwargs = dict()\n
for key in parameter_list:\n
state_change_arg = state_change[\'kwargs\'].get(key)\n
if state_change_arg:\n
kwargs[key] = state_change_arg\n
\n
event.send(**kwargs) # will call type based method\n
</string> </value>
</item>
<item>
......
......@@ -93,30 +93,10 @@
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>send_mail</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>kwargs/send_mail | nothing </string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
676
\ No newline at end of file
685
\ No newline at end of file
......@@ -10,6 +10,7 @@ Campaign | jump_related_event
Campaign | mass_emailing_report
Campaign | new_event
Campaign | view
Campaign | view_communication_plan
Campaign | view_details
Event Module | event_activity
Event Module | event_detailed_report
......@@ -37,10 +38,13 @@ Meeting Module | meeting_detailed_report
Meeting Module | meeting_status
Meeting Module | view
Meeting | clone_ticket_and_event_list
Meeting | create_event_from_event_path
Meeting | create_new_file
Meeting | document_list
Meeting | mass_emailing_report
Meeting | new_event
Meeting | view
Meeting | view_communication_plan
Note | assessment
Note | create_response
Note | preview
......
......@@ -12,6 +12,7 @@ Event Module | Site Message
Event Module | Visit
Event Module | Web Message
Meeting Module | Meeting
Meeting | Event Path
Preference | Support Request
Sale Opportunity Module | Sale Opportunity
Support Request Module | Support Request
\ No newline at end of file
Campaign | Event Path
Campaign | Outcome Path
Event Module | Acknowledgement
Meeting | Event Path
Preference | Support Request
\ No newline at end of file
Campaign | DefaultEventPath
Campaign | DefaultOutcomePath
Event Path | EventPath
Meeting | DefaultEventPath
Support Request | Codification
\ No newline at end of file
......@@ -564,179 +564,6 @@ class EmailDocument(TextDocument):
content_information = self.getContentInformation()
return content_information.get('Return-Path', content_information.get('From'))
security.declareProtected(Permissions.UseMailhostServices, 'send')
def send(self, from_url=None, to_url=None, reply_url=None, subject=None,
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.
XXX - needs to be unified with Event methods
from_url - the sender of this email. If not provided
we will use source to find a valid
email address
to_url - the recipients of this email. If not provided
we will use destination category to
find a list of valid email addresses
reply_url - the email address to reply to. If nothing
is provided, use the email defined in
preferences.
subject - a custom title. If not provided, we will use
getTitle
body - a body message If not provided, we will
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)
download - if set to True returns, the message online
rather than sending it.
TODO: support conversion to base format and use
base format rather than original format
TODO2: consider turning this method into a general method for
any ERP5 document.
"""
if not _checkPermission(Permissions.View, self):
raise Unauthorized
additional_headers = {}
#
# Build mail message
# This part will be replaced with MailTemplate soon.
#
if body is None:
body = self.asText()
# Subject
if subject is None:
subject = self.getTitle()
# From
if from_url is None:
sender = self.getSourceValue()
if sender is not None:
from_url = formataddr((sender.getTitle(),
sender.getDefaultEmailText()))
else:
from_url = self.getSender() # Access sender directly
# Return-Path
if reply_url is None:
reply_url = self.portal_preferences.getPreferredEventSenderEmail()
if reply_url:
additional_headers['Return-Path'] = reply_url
# Reply-To
destination_reference = self.getDestinationReference()
if destination_reference is not None:
additional_headers['In-Reply-To'] = destination_reference
# To (multiple)
to_url_list = set()
to_email_list = []
if to_url is None:
for recipient in self.getDestinationValueList():
email = recipient.getDefaultEmailText()
if email:
if email not in to_email_list:
to_email_list.append(email)
to_url_list.add(formataddr((recipient.getTitle(), email)))
else:
raise ValueError, 'Recipient %s has no defined email' % recipient
if not to_url_list:
to_url_list.add(self.getRecipient())
elif type(to_url) in types.StringTypes:
to_url_list.add(to_url)
# Attachments
if attachment_list is None:
attachment_list = []
document_type_list = self.getPortalDocumentTypeList()
embedded_attachment_list = []
for attachment in self.getAggregateValueList():
mime_type = None
content = None
name = None
if not attachment.getPortalType() in document_type_list:
mime_type = 'application/pdf'
content = attachment.asPDF() # XXX - Not implemented yet
else:
#
# Document type attachment
#
# WARNING - this could fail since getContentType
# is not (yet) part of Document API
if getattr(attachment, 'getContentType', None) is not None:
mime_type = attachment.getContentType()
else:
raise ValueError, "Cannot find mimetype of the document."
if mime_type is not None:
try:
mime_type, content = attachment.convert(mime_type)
except ConversionError:
mime_type = attachment.getBaseContentType()
content = attachment.getBaseData()
except (NotImplementedError, MimeTypeException):
pass
if content is None:
if getattr(attachment, 'getTextContent', None) is not None:
content = attachment.getTextContent()
elif getattr(attachment, 'getData', None) is not None:
content = attachment.getData()
elif getattr(attachment, 'getBaseData', None) is not None:
content = attachment.getBaseData()
if not isinstance(content, str):
content = str(content)
embedded_attachment_list.append({'mime_type':mime_type,
'content':content,
'name':attachment.getReference()}
)
mail_message = None
for to_url in to_url_list:
mime_message = buildEmailMessage(from_url=from_url, to_url=to_url,
msg=body, subject=subject,
attachment_list=(attachment_list + embedded_attachment_list),
additional_headers=additional_headers)
mail_message = mime_message.as_string()
self.activate(activity='SQLQueue').sendMailHostMessage(mail_message)
# Save one of mail messages.
if mail_message is not None:
if len(embedded_attachment_list):
# do not store aggregated documents in Email document
# to avoid duplicate data
tmp_mime_message = buildEmailMessage(from_url=from_url, to_url=to_url,
msg=body, subject=subject,
attachment_list=attachment_list,
additional_headers=additional_headers)
tmp_mail_message = mime_message.as_string()
self.setData(tmp_mail_message)
else:
self.setData(mail_message)
# Only for debugging purpose
if download:
return mail_message
security.declareProtected(Permissions.UseMailhostServices, 'sendMailHostMessage')
def sendMailHostMessage(self, message):
"""
......
......@@ -98,12 +98,11 @@ class Event(Movement, EmailDocument, AcknowledgeableMixin):
of the interface between the ERP and third parties.
Events have a start and stop date.
Events may contain files and local role definitions.
"""
meta_type = 'ERP5 Event'
portal_type = 'Event'
# XXX this is hack so we can search event by delivery.start_date
isDelivery = ConstantGetter('isDelivery', value=True)
# Declarative security
......@@ -163,10 +162,8 @@ class Event(Movement, EmailDocument, AcknowledgeableMixin):
"""
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,
attachment_list, download
)
raise NotImplementedError("`send` type based method not found. "
"Please update erp5_base and erp5_crm")
return send_script(
from_url, to_url, reply_url, subject, body, attachment_format, attachment_list,
download, **kw
......
......@@ -68,24 +68,6 @@ class MailMessage(Event):
, PropertySheet.MailMessage
)
def send(self, from_url=None, to_url=None, msg=None, subject=None):
"""
Sends a reply to this mail message.
"""
# We assume by default that we are replying to the sender
if from_url is None:
from_url = self.getUrlString()
if to_url is None:
to_url = self.getSender()
if msg is not None and subject is not None:
header = "From: %s\n" % from_url
header += "To: %s\n\n" % to_url
header += "Subject: %s\n" % subject
header += "\n"
msg = header + msg
self.MailHost.send( msg )
security.declareProtected(Permissions.AccessContentsInformation, 'getTextContent')
def getTextContent(self, default=_MARKER):
"""
......
......@@ -3,7 +3,6 @@ import re
import os
import sys
import csv
from Products.CMFCore.utils import expandpath
from zLOG import LOG
from App.config import getConfiguration
......@@ -228,7 +227,7 @@ def fixSkinNames(self, REQUEST=None, file=None, dry_run=0):
msg += '%s\n' % line
if not dry_run:
if skin.meta_type in fs_skin_spec:
with open(expandpath(skin.getObjectFSPath()), 'w') as f:
with open(skin.getObjectFSPath(), 'w') as f:
f.write(text)
else:
REQUEST['BODY'] = text
......@@ -359,7 +358,7 @@ def fixSkinNames(self, REQUEST=None, file=None, dry_run=0):
try:
if info.meta_type in fs_skin_spec:
skin = self.portal_skins[info.folder][info.name]
old_path = expandpath(skin.getObjectFSPath())
old_path = skin.getObjectFSPath()
new_path = info.regexp.sub(info.new_name, old_path)
if info.removed:
os.remove(old_path)
......
......@@ -290,6 +290,9 @@ class NotificationTool(BaseTool):
if not isinstance(notifier_list, (tuple, list)):
raise TypeError("Notifier list must be a list of portal types")
if not subject:
raise TypeError("subject is required")
# Find "From" Person
from_person = None
if isinstance(sender, basestring):
......@@ -345,13 +348,17 @@ class NotificationTool(BaseTool):
event_keyword_argument_dict = {}
for notifier in notifier_list:
if notifier in available_notifier_list:
event = self.getDefaultModule(notifier).newContent(portal_type=notifier,
event = portal.getDefaultModule(notifier).newContent(portal_type=notifier,
temp_object=not store_as_event,
**event_keyword_argument_dict)
else:
from Products.ERP5Type.Document import newTempEvent
event = newTempEvent(self, '_',
**event_keyword_argument_dict)
# portal type does not exist, likely erp5_crm is not installed. Try to
# import the class with the same name.
from Products.ERP5Type import Document as document_module
constructor = getattr(document_module,
'newTemp%s' % notifier.replace(' ', ''))
event = constructor(self, '_', **event_keyword_argument_dict)
event.setSourceValue(from_person)
event.setDestinationValueList(to_person_list)
event.setTitle(subject)
......@@ -361,9 +368,10 @@ class NotificationTool(BaseTool):
event_list.append(event)
for event in event_list:
# XXX: this uses too low level API, instead event_workflow should be used in case
# of persistent ERP5 objects
event.send(**low_level_kw)
if event.isTempObject():
event.send(**low_level_kw)
else:
event.start(**low_level_kw)
return
# Future implementation could consist in implementing
......
......@@ -28,6 +28,7 @@
import unittest
import os
import textwrap
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.ERP5Type.tests.utils import FileUpload
......@@ -725,6 +726,43 @@ class TestCRMMailIngestion(BaseTestCRM):
self.assertEquals(new_event.getDestinationList(), ['person_module/me',
'person_module/he'])
# cloned event got a new reference
self.assertNotEqual(new_event.getReference(), event.getReference())
def test_getPropertyDictFromContent_and_defined_arrow(self):
# If source/destination are set on event, then getPropertyDictFromContent
# should not lookup one based on email address.
person = self.portal.person_module.newContent(
portal_type='Person',
default_email_coordinate_text='destination@example.com',)
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation',
default_email_coordinate_text='destination@example.com',)
source_person = self.portal.person_module.newContent(
portal_type='Person',
default_email_coordinate_text='source@example.com',)
self.tic()
event = self.portal.event_module.newContent(
portal_type='Mail Message',
destination_value=organisation,
data='\r\n'.join(textwrap.dedent('''
From: Source <source@example.com>
To: destination <destination@example.com>
Subject: mail subject
content
''').splitlines()[1:]))
property_dict = event.getPropertyDictFromContent()
# destination is set on the event. In this case it is kept as is.
self.assertEquals([organisation.getRelativeUrl()],
property_dict['destination_list'])
# source is not set. In this case it is searched in catalog based on email
# address
self.assertEquals([source_person.getRelativeUrl()],
property_dict['source_list'])
def test_follow_up(self):
# follow up is found automatically, based on the content of the mail, and
# what you defined in preference regexpr.
......@@ -990,10 +1028,9 @@ class TestCRMMailSend(BaseTestCRM):
event.setDestination('person_module/recipient')
event.setTitle('A Mail')
event.setTextContent(text_content)
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
self.portal.portal_workflow.doActionFor(event, 'start_action')
self.tic()
last_message = self.portal.MailHost._last_message
last_message, = self.portal.MailHost._message_list
self.assertNotEquals((), last_message)
mfrom, mto, messageText = last_message
self.assertEquals('"Me," <me@erp5.org>', mfrom)
......@@ -1017,8 +1054,7 @@ class TestCRMMailSend(BaseTestCRM):
event.setDestinationList(['person_module/recipient', 'person_module/me'])
event.setTitle('A Mail')
event.setTextContent(text_content)
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
self.portal.portal_workflow.doActionFor(event, 'start_action')
self.tic()
last_message_1, last_message_2 = self.portal.MailHost._message_list[-2:]
self.assertNotEquals((), last_message_1)
......@@ -1032,19 +1068,20 @@ class TestCRMMailSend(BaseTestCRM):
sorted([x[1] for x in (last_message_1, last_message_2)]))
def test_MailFromMailMessageEventNoSendMail(self):
# passing start_action transition on event workflow will send an email to the
# person as destination, unless you don't check "send_mail" box in the
# workflow dialog
# for Mail Message, passing start_action transition on event workflow will send an email to the
# person as destination. To prevent this, one can use initial_stop_action to mark
# the event receieved.
event = self.portal.event_module.newContent(portal_type='Mail Message')
event.setSource('person_module/me')
event.setDestination('person_module/recipient')
event.setTitle('A Mail')
event.setTextContent('Mail Content')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
self.portal.portal_workflow.doActionFor(event, 'initial_stop_action')
self.assertEquals('stopped', event.getSimulationState())
self.tic()
# no mail sent
last_message = self.portal.MailHost._last_message
self.assertEquals((), last_message)
def test_MailFromOtherEvents(self):
# passing start_action transition on event workflow will not send an email
......@@ -1056,30 +1093,13 @@ class TestCRMMailSend(BaseTestCRM):
event.setSource('person_module/me')
event.setDestination('person_module/recipient')
event.setTextContent('Hello !')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
self.tic()
# this means no message have been set
self.assertEquals((), self.portal.MailHost._last_message)
def test_MailMarkPosted(self):
# start_action transition without send_mail variable on event
# simulation workflow will not send an email even if the portal
# type is a Mail Message
for ptype in [x for x in self.portal.getPortalEventTypeList() if x !=
'Acknowledgement']:
event = self.portal.event_module.newContent(portal_type=ptype)
event.setSource('person_module/me')
event.setDestination('person_module/recipient')
event.setTextContent('Hello !')
self.portal.portal_workflow.doActionFor(event, 'start_action')
self.tic()
# this means no message have been set
self.assertEquals([], self.portal.MailHost._message_list)
self.assertEquals((), self.portal.MailHost._last_message)
def test_MailMessageHTML(self):
# test sending a mail message edited as HTML (the default with FCKEditor),
# then the mail should have HTML.
......@@ -1089,9 +1109,11 @@ class TestCRMMailSend(BaseTestCRM):
event.setDestination('person_module/recipient')
event.setContentType('text/html')
event.setTextContent(text_content)
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
self.portal.portal_workflow.doActionFor(event, 'start_action')
self.tic()
# content type is kept
self.assertEquals(event.getContentType(), 'text/html')
# The getTextContent() gets the content from the file data instead the
# Attribute text_content.
self.assertEquals(event.text_content, text_content)
......@@ -1111,23 +1133,6 @@ class TestCRMMailSend(BaseTestCRM):
self.assertNotEqual(part, None)
self.assertEqual('<html><body>%s</body></html>' % text_content, part.get_payload(decode=True))
def test_MailMessageHTMLbis(self):
# test sending a mail message edited as HTML (the default with FCKEditor),
# then the mail should have HTML
text_content = 'Hello<br/>World'
event = self.portal.event_module.newContent(portal_type='Mail Message')
event.setSource('person_module/me')
event.setDestination('person_module/recipient')
event.setContentType('text/html')
event.setTextContent(text_content)
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
self.tic()
# This test fails because of known issue for outgoing emails.
# there is conflict between properties from data
# and properties from document.
self.assertEquals(event.getContentType(), 'text/html')
def test_MailMessageEncoding(self):
# test sending a mail message with non ascii characters
event = self.portal.event_module.newContent(portal_type='Mail Message')
......@@ -1135,8 +1140,7 @@ class TestCRMMailSend(BaseTestCRM):
event.setDestination('person_module/recipient')
event.setTitle('Héhé')
event.setTextContent('Hàhà')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
self.portal.portal_workflow.doActionFor(event, 'start_action')
self.tic()
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
......@@ -1166,8 +1170,7 @@ class TestCRMMailSend(BaseTestCRM):
self.tic()
# Add a ticket
ticket = self.portal.campaign_module.newContent(id='1',
portal_type='Campaign',
ticket = self.portal.campaign_module.newContent(portal_type='Campaign',
title='Advertisement')
# Create a event
ticket.Ticket_newEvent(portal_type='Mail Message',
......@@ -1176,7 +1179,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='outgoing')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
aggregate=document.getRelativeUrl(),
......@@ -1223,7 +1226,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='outgoing')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
aggregate=document.getRelativeUrl(),
......@@ -1269,7 +1272,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='outgoing')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
aggregate=document.getRelativeUrl(),
......@@ -1315,7 +1318,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='outgoing')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
aggregate=document.getRelativeUrl(),
......@@ -1362,7 +1365,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='outgoing')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
aggregate=document.getRelativeUrl(),
......@@ -1404,7 +1407,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='incoming')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
text_content='This is an advertisement mail.')
......@@ -1460,7 +1463,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='outgoing')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
aggregate=document_txt.getRelativeUrl(),
......@@ -1518,7 +1521,7 @@ class TestCRMMailSend(BaseTestCRM):
direction='outgoing')
# Set sender and attach a document to the event.
event = self.portal.event_module.objectValues()[0]
event, = self.portal.event_module.objectValues()
event.edit(source='person_module/me',
destination='person_module/recipient',
aggregate=document_gif.getRelativeUrl(),
......@@ -1575,6 +1578,7 @@ class TestCRMMailSend(BaseTestCRM):
self.assertEquals(new_event.getData(), '')
self.assertEquals(new_event.getTitle(), real_title)
self.assertEquals(new_event.getTextContent(), real_content)
self.assertNotEquals(new_event.getReference(), event.getReference())
def test_cloneTicketAndEventList(self):
"""
......@@ -1760,44 +1764,52 @@ class TestCRMMailSend(BaseTestCRM):
self.tic()
mail_message = self.portal.event_module.newContent(portal_type="Mail Message")
relative_url_list = [z.getRelativeUrl() for z in self.portal.person_module.searchFolder()]
self.assertEquals(3, len(relative_url_list))
mail_message.setDestinationList(relative_url_list)
mail_message.setSource(relative_url_list[0])
mail_text_content = "Body Text Content"
mail_message.setTextContent(mail_text_content)
self.portal.portal_workflow.doActionFor(mail_message, "start_action")
self.tic()
mail_message.Event_send(packet_size=2)
# directly call MailMessage_send to pass a packet size of 1, so that we
# have one activity per recipient
mail_message.MailMessage_send(packet_size=1)
self.commit()
portal_activities = self.portal.portal_activities
portal_activities.manageInvoke(object_path=mail_message.getPath(), method_id='Event_sendByActivity')
portal_activities.manageInvoke(object_path=mail_message.getPath(),
method_id='immediateReindexObject')
portal_activities.manageInvoke(object_path=mail_message.getPath(),
method_id='MailMessage_sendByActivity')
self.commit()
message_list = [i for i in portal_activities.getMessageList() \
if i.kw.has_key("event_relative_url")]
try:
self.assertEquals(2, len(message_list))
# 3 recipients -> 3 activities
self.assertEquals(3, len(message_list))
finally:
self.tic()
last_message = self.portal.MailHost._last_message
self.assertTrue(mail_text_content in last_message[-1])
message = message_from_string(last_message[-1])
last_message_date = DateTime(message.get("Date"))
self.assertTrue(last_message_date.isCurrentDay())
def test_MailMessage_Event_send_simple_case(self):
self.assertEquals(3, len(self.portal.MailHost._message_list))
for message_info in self.portal.MailHost._message_list:
self.assertTrue(mail_text_content in message_info[-1])
message = message_from_string(message_info[-1])
self.assertTrue(DateTime(message.get("Date")).isCurrentDay())
def test_MailMessage_send_simple_case(self):
"""
Check that the script Event_send send one email passing all parameters directly
Check that the method send send one email passing all parameters directly
from_url, to_url, reply_url, subject, body, attachment_format, attachment_list
"""
mail_message = self.portal.event_module.newContent(portal_type="Mail Message")
self.tic()
mail_message.Event_send(from_url='FG ER <eee@eee.com>',
to_url='Expert User <expert@in24.test>',
subject="Simple Case",
body="Body Simple Case",
attachment_list=[])
mail_message.send(from_url='FG ER <eee@eee.com>',
to_url='Expert User <expert@in24.test>',
subject="Simple Case",
body="Body Simple Case",
attachment_list=[])
self.tic()
last_message = self.portal.MailHost._last_message[-1]
(from_url, to_url, last_message,), = self.portal.MailHost._message_list
self.assertTrue("Body Simple Case" in last_message)
self.assertEquals('FG ER <eee@eee.com>', from_url)
self.assertEquals(['Expert User <expert@in24.test>'], to_url)
def test_suite():
......
......@@ -125,6 +125,7 @@ class TestNotificationTool(ERP5TypeTestCase):
if 'MailHost' in portal.objectIds():
portal.manage_delObjects(['MailHost'])
portal._setObject('MailHost', DummyMailHost('MailHost'))
self.portal.MailHost.reset()
portal.email_from_address = 'site@example.invalid'
self.portal.portal_caches.clearAllCache()
self.tic()
......@@ -464,8 +465,7 @@ Yes, I will go."""
self.portal.portal_notifications.sendMessage(
recipient='userA', subject='Subject',
message_text_format='text/html', message=message)
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
last_message, = self.portal.MailHost._message_list
mfrom, mto, messageText = last_message
self.assertEquals('Portal Administrator <site@example.invalid>', mfrom)
self.assertEquals(['userA@example.invalid'], mto)
......@@ -514,8 +514,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
subject='Subject',
message='Message')
self.tic()
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
last_message, = self.portal.MailHost._message_list
mfrom, mto, messageText = last_message
mail_dict = decode_email(messageText)
self.assertEquals('Portal Administrator <site@example.invalid>', mfrom)
......
......@@ -28,7 +28,7 @@
##############################################################################
from AccessControl import ClassSecurityInfo
from Globals import PersistentMapping
from Persistence import PersistentMapping
from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet
......
......@@ -5,7 +5,6 @@ from Products.CMFCore.permissions import View, ViewManagementScreens
from Products.CMFCore.FSObject import FSObject
from Products.CMFCore.DirectoryView import registerFileExtension,\
registerMetaType
from Products.CMFCore.utils import expandpath
from Products.ERP5Form import _dtmldir
from Products.ERP5Form.Form import ERP5Form
......@@ -39,7 +38,7 @@ class ERP5FSForm(FSObject, ERP5Form):
return obj
def _readFile(self, reparse):
f = open(expandpath(self._filepath), 'rb')
f = open(self._filepath, 'rb')
# update the form with the xml data
try:
XMLToForm(f.read(), self)
......@@ -49,7 +48,7 @@ class ERP5FSForm(FSObject, ERP5Form):
# (except if the LOG raises another one ... should we be more paranoid here?)
import zLOG
zLOG.LOG('Formulator.FSForm',zLOG.ERROR,
'error reading form from file '+expandpath(self._filepath))
'error reading form from file '+self._filepath)
raise
f.close()
......
......@@ -38,7 +38,7 @@ from Products.CMFCore.exceptions import AccessControl_Unauthorized
from Acquisition import Implicit, aq_base
from Products.ERP5Type.Globals import InitializeClass, DTMLFile, Persistent
from AccessControl import ClassSecurityInfo
from AccessControl.Role import RoleManager
from OFS.role import RoleManager
from OFS.SimpleItem import Item
from OFS.PropertyManager import PropertyManager
from urllib import quote, quote_plus
......
......@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Permissions import ManagePortal
from Globals import DTMLFile
from Products.ERP5Type.Globals import DTMLFile
from Products.ERP5SecurePayment import _dtmldir
from Products.ERP5Security.ERP5UserManager import SUPER_USER
from AccessControl.SecurityManagement import newSecurityManager
......
......@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Permissions import ManagePortal
from Globals import DTMLFile
from Products.ERP5Type.Globals import DTMLFile
from Products.ERP5ShortMessage import _dtmldir
class SMSTool(BaseTool):
......
......@@ -52,7 +52,7 @@ from copy import deepcopy
import logging
syncml_logger = logging.getLogger('ERP5SyncML')
import sha
from hashlib import sha1
from Products.ERP5SyncML.SyncMLConstant import XUPDATE_ELEMENT,\
XUPDATE_INSERT_OR_ADD_LIST, XUPDATE_DEL, XUPDATE_UPDATE, XUPDATE_INSERT_LIST
......@@ -224,7 +224,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
def deleteWorkflowNode():
for wf_id, wf_history_tuple in object.workflow_history.iteritems():
for wf_history_index, wf_history in enumerate(wf_history_tuple):
if sha.new(wf_id + str(wf_history['time']) +
if sha1(wf_id + str(wf_history['time']) +
wf_history['actor']).hexdigest() == wf_action_id:
object.workflow_history[wf_id] = (
object.workflow_history[wf_id][:wf_history_index] +
......
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass, DTMLFile
from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from Products.ERP5 import _dtmldir
from Products.ERP5Type import Permissions
from Products.ERP5Type.Tool.BaseTool import BaseTool
......
......@@ -39,7 +39,7 @@ from OFS.Image import Pdata
from zLOG import LOG
from base64 import standard_b64encode
import sha
from hashlib import sha1
MARSHALLER_NAMESPACE_URI = 'http://www.erp5.org/namespaces/marshaller'
marshaller = Marshaller(namespace_uri=MARSHALLER_NAMESPACE_URI,
......@@ -153,7 +153,7 @@ def Base_asXML(object, root=None):
elif workflow_variable == 'actor':
actor = variable_node.text
workflow_node.attrib['id'] = sha.new(workflow_id + time +
workflow_node.attrib['id'] = sha1(workflow_id + time +
str(actor.encode('utf-8'))).hexdigest()
# We should now describe security settings
......
......@@ -7,15 +7,16 @@
#
from Products.CMFCore.FSZSQLMethod import FSZSQLMethod
from Products.CMFCore.utils import expandpath
from Products.ZSQLMethods.SQL import SQL
def FSZSQLMethod_readFile(self, reparse):
fp = expandpath(self._filepath)
file = open(fp, 'r') # not 'rb', as this is a text file!
"""Read the data from the filesystem.
"""
file = open(self._filepath, 'r') # not 'rb', as this is a text file!
try:
data = file.read()
finally: file.close()
finally:
file.close()
RESPONSE = {}
RESPONSE['BODY'] = data
......
......@@ -9,13 +9,12 @@ except ImportError:
from Products.CMFCore.FSObject import FSObject
from Products.CMFCore.DirectoryView import registerFileExtension,\
registerMetaType
from Products.CMFCore.utils import expandpath
else:
# use FileSystemSite product
from Products.FileSystemSite.Permissions import View
from Products.FileSystemSite.FSObject import FSObject
from Products.FileSystemSite.DirectoryView import registerFileExtension,\
registerMetaType, expandpath
registerMetaType
from Products.Formulator.Form import ZMIForm
from Products.Formulator.XMLToForm import XMLToForm
......@@ -45,7 +44,7 @@ class FSForm(FSObject, ZMIForm):
return None
def _readFile(self, reparse):
file = open(expandpath(self._filepath), 'rb')
file = open(self._filepath, 'rb')
try:
data = file.read()
finally:
......@@ -63,7 +62,7 @@ class FSForm(FSObject, ZMIForm):
zLOG.LOG(
'Formulator.FSForm', zLOG.ERROR,
'error reading form from file ' +
expandpath(self._filepath))
self._filepath)
raise
#### The following is mainly taken from Form.py ACCESSORS section ###
......
......@@ -5,7 +5,7 @@ from Acquisition import aq_base
from App.special_dtml import DTMLFile
from Persistence import Persistent
from AccessControl import ClassSecurityInfo
from AccessControl.Role import RoleManager
from OFS.role import RoleManager
from OFS.ObjectManager import ObjectManager
from OFS.PropertyManager import PropertyManager
from OFS.SimpleItem import Item
......
......@@ -8,7 +8,6 @@ from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
from App.class_init import default__class_init__ as InitializeClass
from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.utils import expandpath
from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.DirectoryView import registerMetaType
......@@ -44,7 +43,7 @@ class FSMailTemplate(BaseMailTemplate,FSPageTemplate):
security.declarePrivate('_readFile')
def _readFile(self, reparse):
fp = expandpath(self._filepath)
fp = self._filepath
file = open(fp, 'r') # not 'rb', as this is a text file!
try:
data = file.read()
......
......@@ -5,7 +5,7 @@ from Persistence import Persistent
from App.class_init import default__class_init__ as InitializeClass
from Acquisition import Implicit
from OFS.SimpleItem import Item
from AccessControl.Role import RoleManager
from OFS.role import RoleManager
from AccessControl import ClassSecurityInfo
from Products.CMFCore.permissions import ManagePortal, ManageProperties
......
......@@ -6,7 +6,8 @@ LDAP Entry Objects
__version__ = "$Revision: 1.13 $"[11:-2]
import Acquisition, AccessControl, OFS, string
from Globals import HTMLFile, MessageDialog; import Globals
from App.special_dtml import HTMLFile
from App.Dialogs import MessageDialog
import ldap, urllib, UserList
ConnectionError='ZLDAP Connection Error'
......
......@@ -11,7 +11,9 @@ __version__ = "$Revision: 1.11 $"[11:-2]
import Acquisition, AccessControl, OFS, string
from Acquisition import aq_base
from Globals import HTMLFile, MessageDialog, Persistent
from App.special_dtml import HTMLFile
from App.Dialogs import MessageDialog
from Persistence import Persistent
import ldap, urllib
import LDCAccessors
......
......@@ -2,7 +2,6 @@
# core of LDAP Filter Methods.
from Globals import HTMLFile, HTML
__version__ = "$Revision: 1.10 $"[11:-2]
try:
......@@ -17,8 +16,10 @@ import string
from Shared.DC.ZRDB import Aqueduct
from Shared.DC.ZRDB.Aqueduct import parse, decodestring, default_input_form
from Shared.DC.ZRDB.Results import Results
import Acquisition, Globals, AccessControl.Role, OFS.SimpleItem
from Globals import HTMLFile, MessageDialog, Persistent
import Acquisition, AccessControl.Role, OFS.SimpleItem
from App.special_dtml import HTMLFile
from App.Dialogs import MessageDialog
from Persistence import Persistent
import DocumentTemplate
import ExtensionClass
import sys
......@@ -26,7 +27,10 @@ import sys
from zLOG import LOG, INFO
from ldif import LDIFRecordList, is_dn, valid_changetype_dict, CHANGE_TYPES
import ldifvar
from AccessControl.DTML import RestrictedDTML
try:
from DocumentTemplate.security import RestrictedDTML
except ImportError: # BBB Zope-2.12
from AccessControl.DTML import RestrictedDTML
try:
from AccessControl import getSecurityManager
except ImportError:
......@@ -186,7 +190,7 @@ class LDAPError(Exception):
class LDAPMethod(Aqueduct.BaseQuery,
Acquisition.Implicit,
Globals.Persistent,
Persistent,
AccessControl.Role.RoleManager,
OFS.SimpleItem.Item,
):
......@@ -564,4 +568,4 @@ pretty_results=DocumentTemplate.HTML("""\
import App.class_init
App.class_init.default__class_init__(LDAPMethod)
App.class_init.default__class_init__(LDIFMethod)
\ No newline at end of file
App.class_init.default__class_init__(LDIFMethod)
......@@ -60,7 +60,6 @@
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
from string import find, split, join, atoi, atof
import sha
StringType=type('')
str=__builtins__['str']
......
......@@ -26,7 +26,10 @@ from DocumentTemplate.DT_Util import Eval
from AccessControl.Permission import name_trans
from SQLCatalog import CatalogError
from AccessControl import ClassSecurityInfo
from AccessControl.DTML import RestrictedDTML
try:
from DocumentTemplate.security import RestrictedDTML
except ImportError: # BBB Zope-2.12
from AccessControl.DTML import RestrictedDTML
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.Cache import clearCache
import string, sys
......
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