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 @@
"""\n
kw[\'portal_type\'] = context.getPortalDocumentTypeList()\n
kw[\'sort_on\'] = ((\'creation_date\', \'descending\'),)\n
result = context.portal_catalog(**kw)\n
return result\n
return context.portal_catalog(**kw)\n
</string> </value>
</item>
<item>
......@@ -129,7 +128,6 @@ return result\n
<string>context</string>
<string>_write_</string>
<string>_apply_</string>
<string>result</string>
</tuple>
</value>
</item>
......
......@@ -76,13 +76,9 @@
WARNING: implementation depends on the fact\n
that owner is being indexed.\n
"""\n
if user is None:\n
from AccessControl import getSecurityManager\n
sm = getSecurityManager()\n
user = sm.getUser()\n
\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
</string> </value>
</item>
......@@ -134,14 +130,9 @@ return context.portal_catalog(**kw)\n
<tuple>
<string>user</string>
<string>kw</string>
<string>None</string>
<string>AccessControl</string>
<string>getSecurityManager</string>
<string>sm</string>
<string>_getattr_</string>
<string>context</string>
<string>_write_</string>
<string>str</string>
<string>_apply_</string>
</tuple>
</value>
......
......@@ -337,10 +337,6 @@
<string>language</string>
<string>language</string>
</tuple>
<tuple>
<string>creation_date</string>
<string>creation_date</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
......@@ -358,31 +354,35 @@
<list>
<tuple>
<string>id</string>
<string>id</string>
<string>ID</string>
</tuple>
<tuple>
<string>portal_type</string>
<string>portal_type</string>
<string>Portal Type</string>
</tuple>
<tuple>
<string>title</string>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>reference</string>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>version</string>
<string>version</string>
<string>Version</string>
</tuple>
<tuple>
<string>language</string>
<string>language</string>
<string>Language</string>
</tuple>
<tuple>
<string>creation_date</string>
<string>Created</string>
<string>revision</string>
<string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple>
<tuple>
<string>modification_date</string>
......@@ -530,8 +530,40 @@
<value>
<list>
<tuple>
<string>None</string>
<string>None</string>
<string>id</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>
</list>
</value>
......
......@@ -323,7 +323,7 @@
</tuple>
<tuple>
<string>portal_type</string>
<string>Type</string>
<string>Portal Type</string>
</tuple>
<tuple>
<string>title</string>
......@@ -342,8 +342,16 @@
<string>Language</string>
</tuple>
<tuple>
<string>creation_date</string>
<string>Created</string>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>revision</string>
<string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple>
<tuple>
<string>modification_date</string>
......@@ -370,16 +378,12 @@
</tuple>
<tuple>
<string>portal_type</string>
<string>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>
......@@ -389,8 +393,16 @@
<string>Language</string>
</tuple>
<tuple>
<string>creation_date</string>
<string>Created</string>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>revision</string>
<string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple>
<tuple>
<string>modification_date</string>
......@@ -435,10 +447,6 @@
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>creation_date</string>
<string>creation_date</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
......@@ -562,8 +570,12 @@
<string>language</string>
</tuple>
<tuple>
<string>creation_date</string>
<string>Created</string>
<string>revision</string>
<string>Revision</string>
</tuple>
<tuple>
<string>validation_state</string>
<string>State</string>
</tuple>
<tuple>
<string>modification_date</string>
......
......@@ -80,13 +80,13 @@
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
\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
print "no sender in headers"\n
return printed\n
msg = \'[DMS] No sender in email message\'\n
context.log(msg)\n
return msg\n
\n
# find sender in ERP5\n
found_persons = context.portal_catalog(portal_type=\'Person\', reference=sender_email)\n
......@@ -123,7 +123,7 @@ try:\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 \'OK\'\n
return 0\n
except Exception, e:\n
# failure during ingestion, inform user to try again later\n
context.Document_notifyByEmail(sender_email, \n
......@@ -133,7 +133,6 @@ except Exception, e:\n
context.log(\'[DMS] Failure (%s) email ingestion for %s <%s> (%s)\' \n
%(e, person.getTitle(), sender_email, file_name))\n
raise Exception, e\n
return \'ERROR\'\n
]]></string> </value>
......@@ -187,17 +186,15 @@ except Exception, e:\n
<value>
<tuple>
<string>theMail</string>
<string>_print_</string>
<string>_print</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_persons</string>
<string>len</string>
<string>msg</string>
<string>person</string>
<string>mailprops</string>
<string>_getiter_</string>
......@@ -230,6 +227,10 @@ except Exception, e:\n
<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>
......
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