Commit d21dbb09 authored by Bartek Górny's avatar Bartek Górny

fixed a problem which occurred in email ingestion because then the scripts are...

fixed a problem which occurred in email ingestion because then the scripts are run as zope user, so they need to be passed user name explicitly

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11779 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cd5e6ad6
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
# first try from content\n # first try from content\n
context.log(fname,doctype)\n context.log(fname,doctype)\n
if doctype is None or doctype==\'\':\n if doctype is None or doctype==\'\':\n
props=context.Document_getPropertyListFromContent(context,data)\n props=context.Document_getPropertyListFromContent(context,data,None)\n
doctype=props.get(\'doctype\')\n doctype=props.get(\'doctype\')\n
# then from filename\n # then from filename\n
if doctype is None or doctype==\'\':\n if doctype is None or doctype==\'\':\n
...@@ -103,7 +103,7 @@ if mod is None:\n ...@@ -103,7 +103,7 @@ if mod is None:\n
# create and populate object\n # create and populate object\n
ob=mod.newContent(portal_type=doctype)\n ob=mod.newContent(portal_type=doctype)\n
ob.manage_upload(data)\n ob.manage_upload(data)\n
ob.Document_setOtherProperties()\n ob.Document_setOtherProperties(uname)\n
ob.DMS_ingestFile(fname,data)\n ob.DMS_ingestFile(fname,data)\n
return ob\n return ob\n
</string> </value> </string> </value>
...@@ -122,7 +122,7 @@ return ob\n ...@@ -122,7 +122,7 @@ return ob\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>fname,data, doctype=None</string> </value> <value> <string>fname,data, doctype=None,uname=None</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -142,7 +142,7 @@ return ob\n ...@@ -142,7 +142,7 @@ return ob\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -151,6 +151,7 @@ return ob\n ...@@ -151,6 +151,7 @@ return ob\n
<string>fname</string> <string>fname</string>
<string>data</string> <string>data</string>
<string>doctype</string> <string>doctype</string>
<string>uname</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>None</string> <string>None</string>
...@@ -178,6 +179,7 @@ return ob\n ...@@ -178,6 +179,7 @@ return ob\n
<value> <value>
<tuple> <tuple>
<none/> <none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -103,7 +103,7 @@ context.log(mailprops)\n ...@@ -103,7 +103,7 @@ context.log(mailprops)\n
# create objects from attachments\n # create objects from attachments\n
try:\n try:\n
for fname,data in theMail[\'attachments\'].items():\n for fname,data in theMail[\'attachments\'].items():\n
obj=context.DMS_createObjectFromFile(fname,data,mailprops.get(\'document_type\'))\n obj=context.DMS_createObjectFromFile(fname,data,mailprops.get(\'document_type\'),uname=person.getReference())\n
# if some properties were in the mail, overwrite the content attrs\n # if some properties were in the mail, overwrite the content attrs\n
for k in mailprops:\n for k in mailprops:\n
atr=k\n atr=k\n
...@@ -114,11 +114,13 @@ try:\n ...@@ -114,11 +114,13 @@ try:\n
if gr is None:\n if gr is None:\n
print noSubordinationMsg\n print noSubordinationMsg\n
return printed\n return printed\n
obj.setGroup(person.getSubordinationValue().getGroup())\n obj.setGroup(gr)\n
obj.manage_setLocalRoles(person.getReference(),[\'Owner\',])\n obj.manage_setLocalRoles(person.getReference(),[\'Owner\',])\n
context.DMS_notifyByEmail(address=senderemail,event=\'ingest\',object=obj)\n context.DMS_notifyByEmail(address=senderemail,event=\'ingest\',object=obj)\n
except Exception,e:\n except Exception,e:\n
return str(e)\n context.log_traceback(context)\n
raise\n
#return str(e)\n
return\n return\n
...@@ -192,7 +194,6 @@ return\n ...@@ -192,7 +194,6 @@ return\n
<string>gr</string> <string>gr</string>
<string>Exception</string> <string>Exception</string>
<string>e</string> <string>e</string>
<string>str</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>user=None</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -112,12 +112,14 @@ ...@@ -112,12 +112,14 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple/> <tuple>
<string>user</string>
</tuple>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -128,7 +130,9 @@ ...@@ -128,7 +130,9 @@
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple>
<none/> <none/>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
420 422
\ 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