Commit becbed56 authored by Ivan Tyagov's avatar Ivan Tyagov

Minor Code& Forms cleanup. Added preferred email ingestion address form field to preferences form.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14524 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bfa1b268
...@@ -73,8 +73,7 @@ ...@@ -73,8 +73,7 @@
"""\n """\n
kw[\'portal_type\'] = context.getPortalDocumentTypeList()\n kw[\'portal_type\'] = context.getPortalDocumentTypeList()\n
kw[\'sort_on\'] = ((\'creation_date\', \'descending\'),)\n kw[\'sort_on\'] = ((\'creation_date\', \'descending\'),)\n
result = context.portal_catalog(**kw)\n return context.portal_catalog(**kw)\n
return result\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -129,7 +128,6 @@ return result\n ...@@ -129,7 +128,6 @@ return result\n
<string>context</string> <string>context</string>
<string>_write_</string> <string>_write_</string>
<string>_apply_</string> <string>_apply_</string>
<string>result</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -76,13 +76,9 @@ ...@@ -76,13 +76,9 @@
WARNING: implementation depends on the fact\n WARNING: implementation depends on the fact\n
that owner is being indexed.\n that owner is being indexed.\n
"""\n """\n
if user is None:\n
from AccessControl import getSecurityManager\n
sm = getSecurityManager()\n
user = sm.getUser()\n
\n \n
kw[\'portal_type\'] = context.getPortalMyDocumentTypeList()\n kw[\'portal_type\'] = context.getPortalMyDocumentTypeList()\n
kw[\'owner\'] = str(user)\n kw[\'owner\'] = context.portal_membership.getAuthenticatedMember()\n
return context.portal_catalog(**kw)\n return context.portal_catalog(**kw)\n
</string> </value> </string> </value>
</item> </item>
...@@ -134,14 +130,9 @@ return context.portal_catalog(**kw)\n ...@@ -134,14 +130,9 @@ return context.portal_catalog(**kw)\n
<tuple> <tuple>
<string>user</string> <string>user</string>
<string>kw</string> <string>kw</string>
<string>None</string>
<string>AccessControl</string>
<string>getSecurityManager</string>
<string>sm</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>_write_</string> <string>_write_</string>
<string>str</string>
<string>_apply_</string> <string>_apply_</string>
</tuple> </tuple>
</value> </value>
......
...@@ -337,10 +337,6 @@ ...@@ -337,10 +337,6 @@
<string>language</string> <string>language</string>
<string>language</string> <string>language</string>
</tuple> </tuple>
<tuple>
<string>creation_date</string>
<string>creation_date</string>
</tuple>
<tuple> <tuple>
<string>modification_date</string> <string>modification_date</string>
<string>modification_date</string> <string>modification_date</string>
...@@ -358,31 +354,35 @@ ...@@ -358,31 +354,35 @@
<list> <list>
<tuple> <tuple>
<string>id</string> <string>id</string>
<string>id</string> <string>ID</string>
</tuple> </tuple>
<tuple> <tuple>
<string>portal_type</string> <string>portal_type</string>
<string>portal_type</string> <string>Portal Type</string>
</tuple> </tuple>
<tuple> <tuple>
<string>title</string> <string>title</string>
<string>title</string> <string>Title</string>
</tuple> </tuple>
<tuple> <tuple>
<string>reference</string> <string>reference</string>
<string>reference</string> <string>Reference</string>
</tuple> </tuple>
<tuple> <tuple>
<string>version</string> <string>version</string>
<string>version</string> <string>Version</string>
</tuple> </tuple>
<tuple> <tuple>
<string>language</string> <string>language</string>
<string>language</string> <string>Language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>creation_date</string> <string>revision</string>
<string>Created</string> <string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple> </tuple>
<tuple> <tuple>
<string>modification_date</string> <string>modification_date</string>
...@@ -530,8 +530,40 @@ ...@@ -530,8 +530,40 @@
<value> <value>
<list> <list>
<tuple> <tuple>
<string>None</string> <string>id</string>
<string>None</string> <string>id</string>
</tuple>
<tuple>
<string>portal_type</string>
<string>portal_type</string>
</tuple>
<tuple>
<string>title</string>
<string>title</string>
</tuple>
<tuple>
<string>reference</string>
<string>reference</string>
</tuple>
<tuple>
<string>version</string>
<string>version</string>
</tuple>
<tuple>
<string>language</string>
<string>language</string>
</tuple>
<tuple>
<string>revision</string>
<string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>Modified</string>
</tuple> </tuple>
</list> </list>
</value> </value>
......
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
</tuple> </tuple>
<tuple> <tuple>
<string>portal_type</string> <string>portal_type</string>
<string>Type</string> <string>Portal Type</string>
</tuple> </tuple>
<tuple> <tuple>
<string>title</string> <string>title</string>
...@@ -342,8 +342,16 @@ ...@@ -342,8 +342,16 @@
<string>Language</string> <string>Language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>creation_date</string> <string>reference</string>
<string>Created</string> <string>Reference</string>
</tuple>
<tuple>
<string>revision</string>
<string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple> </tuple>
<tuple> <tuple>
<string>modification_date</string> <string>modification_date</string>
...@@ -370,16 +378,12 @@ ...@@ -370,16 +378,12 @@
</tuple> </tuple>
<tuple> <tuple>
<string>portal_type</string> <string>portal_type</string>
<string>Type</string> <string>Portal Type</string>
</tuple> </tuple>
<tuple> <tuple>
<string>title</string> <string>title</string>
<string>Title</string> <string>Title</string>
</tuple> </tuple>
<tuple>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple> <tuple>
<string>version</string> <string>version</string>
<string>Version</string> <string>Version</string>
...@@ -389,8 +393,16 @@ ...@@ -389,8 +393,16 @@
<string>Language</string> <string>Language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>creation_date</string> <string>reference</string>
<string>Created</string> <string>Reference</string>
</tuple>
<tuple>
<string>revision</string>
<string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple> </tuple>
<tuple> <tuple>
<string>modification_date</string> <string>modification_date</string>
...@@ -435,10 +447,6 @@ ...@@ -435,10 +447,6 @@
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <value>
<list> <list>
<tuple>
<string>creation_date</string>
<string>creation_date</string>
</tuple>
<tuple> <tuple>
<string>modification_date</string> <string>modification_date</string>
<string>modification_date</string> <string>modification_date</string>
...@@ -562,8 +570,12 @@ ...@@ -562,8 +570,12 @@
<string>language</string> <string>language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>creation_date</string> <string>revision</string>
<string>Created</string> <string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple> </tuple>
<tuple> <tuple>
<string>modification_date</string> <string>modification_date</string>
......
...@@ -80,13 +80,13 @@ ...@@ -80,13 +80,13 @@
If it returns anything, it is bounced back to the sender as an error message. No return\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 value means everything was fine.\n
"""\n """\n
\n
# get sender from email headers\n # get sender from email headers\n
raw_sender_email = theMail[\'headers\'][\'from\']\n raw_sender_email = theMail[\'headers\'][\'from\']\n
sender_email = context.findAddress(raw_sender_email)\n sender_email = context.findAddress(raw_sender_email)\n
if sender_email is None:\n if sender_email is None:\n
print "no sender in headers"\n msg = \'[DMS] No sender in email message\'\n
return printed\n context.log(msg)\n
return msg\n
\n \n
# find sender in ERP5\n # find sender in ERP5\n
found_persons = context.portal_catalog(portal_type=\'Person\', reference=sender_email)\n found_persons = context.portal_catalog(portal_type=\'Person\', reference=sender_email)\n
...@@ -123,7 +123,7 @@ try:\n ...@@ -123,7 +123,7 @@ try:\n
context.Document_notifyByEmail(sender_email, \'ingestion_success\', merged_content)\n context.Document_notifyByEmail(sender_email, \'ingestion_success\', merged_content)\n
context.log(\'[DMS] Finished email ingestion for %s <%s> (%s)\' \n context.log(\'[DMS] Finished email ingestion for %s <%s> (%s)\' \n
%(person.getTitle(), sender_email, file_name))\n %(person.getTitle(), sender_email, file_name))\n
return \'OK\'\n return 0\n
except Exception, e:\n except Exception, e:\n
# failure during ingestion, inform user to try again later\n # failure during ingestion, inform user to try again later\n
context.Document_notifyByEmail(sender_email, \n context.Document_notifyByEmail(sender_email, \n
...@@ -133,7 +133,6 @@ except Exception, e:\n ...@@ -133,7 +133,6 @@ except Exception, e:\n
context.log(\'[DMS] Failure (%s) email ingestion for %s <%s> (%s)\' \n context.log(\'[DMS] Failure (%s) email ingestion for %s <%s> (%s)\' \n
%(e, person.getTitle(), sender_email, file_name))\n %(e, person.getTitle(), sender_email, file_name))\n
raise Exception, e\n raise Exception, e\n
return \'ERROR\'\n
]]></string> </value> ]]></string> </value>
...@@ -187,17 +186,15 @@ except Exception, e:\n ...@@ -187,17 +186,15 @@ except Exception, e:\n
<value> <value>
<tuple> <tuple>
<string>theMail</string> <string>theMail</string>
<string>_print_</string>
<string>_print</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>raw_sender_email</string> <string>raw_sender_email</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>sender_email</string> <string>sender_email</string>
<string>None</string> <string>None</string>
<string>msg</string>
<string>found_persons</string> <string>found_persons</string>
<string>len</string> <string>len</string>
<string>msg</string>
<string>person</string> <string>person</string>
<string>mailprops</string> <string>mailprops</string>
<string>_getiter_</string> <string>_getiter_</string>
...@@ -230,6 +227,10 @@ except Exception, e:\n ...@@ -230,6 +227,10 @@ except Exception, e:\n
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Document_ingestEmail</string> </value> <value> <string>Document_ingestEmail</string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Ingest document from an email message</string> </value>
</item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
<value> <value>
......
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