Commit 506207fa authored by Yusei Tahara's avatar Yusei Tahara

Removed unused old scripts.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18254 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 698bc8d5
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</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[
"""\n
The email ingestion script, called by ZMailIn upon reception of an email.\n
Finds out who sent the letter, finds the sender, discovers properties that may\n
be contained in the mail body (using Document_getPropertyListFromMail),\n
then creates and object from every attachment and sends notifications to the \n
sender.\n
\n
If it returns anything, it is bounced back to the sender as an error message. No return\n
value means everything was fine.\n
"""\n
# get sender from email headers\n
raw_sender_email = theMail[\'headers\'][\'from\']\n
sender_email = context.findAddress(raw_sender_email)\n
if sender_email is None:\n
msg = \'[DMS] No sender in email message\'\n
context.log(msg)\n
return msg\n
\n
# find sender in ERP5\n
found_email_list = context.portal_catalog(portal_type=\'Email\', url_string=sender_email)\n
if len(found_email_list) == 0:\n
msg = \'[DMS] You are not in user database\'\n
context.log(msg)\n
return msg\n
if len(found_email_list) > 1:\n
msg = \'[DMS] Your email address has multiple entries\'\n
context.log(msg)\n
return msg\n
\n
person = found_email_list[0].getParentValue()\n
\n
# get mail properties out of mail body\n
mailprops = context.Document_getPropertyDictFromMail(theMail[\'body\'])\n
\n
# try to ingest document for each attachment\n
try:\n
for attachment in theMail[\'attachment_list\']:\n
file_name, content_type, data = attachment\n
kw = dict(file_name = file_name,\n
data = data,\n
discover_metadata = 0)\n
new_content = context.portal_contributions.newContent(**kw)\n
merged_content = new_content.discoverMetadata(file_name = file_name)\n
if new_content == merged_content:\n
# we have a new document in the system, so set local role owner to email sender\n
new_content.manage_setLocalRoles(person.getReference(), [\'Owner\',])\n
\n
new_content.immediateReindexObject()\n
merged_content.immediateReindexObject()\n
# notify sender for successful email ingestion\n
context.Document_notifyByEmail(sender_email, \'ingestion_success\', merged_content)\n
context.log(\'[DMS] Finished email ingestion for %s <%s> (%s)\' \n
%(person.getTitle(), sender_email, file_name))\n
return 0\n
except Exception, e:\n
# failure during ingestion, inform user to try again later\n
context.Document_notifyByEmail(sender_email, \n
\'ingestion_failure\', \n
context, \n
original_email = theMail)\n
context.log(\'[DMS] Failure (%s) email ingestion for %s <%s>\' \n
%(e, person.getTitle(), sender_email))\n
raise Exception, e\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>_params</string> </key>
<value> <string>theMail</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>theMail</string>
<string>_getitem_</string>
<string>raw_sender_email</string>
<string>_getattr_</string>
<string>context</string>
<string>sender_email</string>
<string>None</string>
<string>msg</string>
<string>found_email_list</string>
<string>len</string>
<string>person</string>
<string>mailprops</string>
<string>_getiter_</string>
<string>attachment</string>
<string>file_name</string>
<string>content_type</string>
<string>data</string>
<string>dict</string>
<string>kw</string>
<string>_apply_</string>
<string>new_content</string>
<string>merged_content</string>
<string>Exception</string>
<string>e</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Document_ingestEmail</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ingest document from an email message</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="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[
"""\n
This function sends a notification mail to person who is allowed to modify\n
current document.\n
"""\n
\n
persons_to_inform = []\n
\n
# find which persons have needed roles so they can be informed\n
person_list = context.getPortalObject().portal_catalog(portal_type = \'Person\', reference=\'%\')\n
for person in person_list:\n
local_roles = context.Document_getPersonRoleList(person, context)\n
# check if person\'s roles in this document\'s context allow him/her to modify it\n
intersect = [k for k in local_roles if k in roles_to_inform]\n
if len(intersect) > 0:\n
persons_to_inform.append(person)\n
\n
# email templates\n
if event in (\'release\',):\n
subject_template = \'[DMS] Document owned by you was released.\'\n
email_template = """Your document "%(name)s" was released.\n
\n
click here: %(url)s/view to check it."""\n
elif event in (\'publish\',):\n
subject_template = \'[DMS] Document owned by you was published.\'\n
email_template = """Your document "%(name)s" was published.\n
\n
click here: %(url)s/view to check it."""\n
\n
# send email to owner\n
for person in persons_to_inform:\n
email_subject = subject_template %dict(name = context.getTitle())\n
email_text = email_template % dict(name = context.getTitle(),\n
url = context.absolute_url())\n
email_to = person.getDefaultEmailText()\n
context.MailHost.send(messageText = email_text, \n
mto = email_to, \n
mfrom = \'dms@dms.nexedi.com\', \n
subject = email_subject)\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>event=\'publish\', roles_to_inform = (\'Owner\', \'Assignor\',)</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>event</string>
<string>roles_to_inform</string>
<string>persons_to_inform</string>
<string>_getattr_</string>
<string>context</string>
<string>person_list</string>
<string>_getiter_</string>
<string>person</string>
<string>local_roles</string>
<string>append</string>
<string>$append0</string>
<string>k</string>
<string>intersect</string>
<string>len</string>
<string>subject_template</string>
<string>email_template</string>
<string>dict</string>
<string>email_subject</string>
<string>email_text</string>
<string>email_to</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<string>publish</string>
<tuple>
<string>Owner</string>
<string>Assignor</string>
</tuple>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Document_notifyOnChange</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
758 759
\ 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