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 @@
# first try from content\n
context.log(fname,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
# then from filename\n
if doctype is None or doctype==\'\':\n
......@@ -103,7 +103,7 @@ if mod is None:\n
# create and populate object\n
ob=mod.newContent(portal_type=doctype)\n
ob.manage_upload(data)\n
ob.Document_setOtherProperties()\n
ob.Document_setOtherProperties(uname)\n
ob.DMS_ingestFile(fname,data)\n
return ob\n
</string> </value>
......@@ -122,7 +122,7 @@ return ob\n
</item>
<item>
<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>
<key> <string>errors</string> </key>
......@@ -142,7 +142,7 @@ return ob\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>3</int> </value>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -151,6 +151,7 @@ return ob\n
<string>fname</string>
<string>data</string>
<string>doctype</string>
<string>uname</string>
<string>_getattr_</string>
<string>context</string>
<string>None</string>
......@@ -178,6 +179,7 @@ return ob\n
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
......
......@@ -103,7 +103,7 @@ context.log(mailprops)\n
# create objects from attachments\n
try:\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
for k in mailprops:\n
atr=k\n
......@@ -114,11 +114,13 @@ try:\n
if gr is None:\n
print noSubordinationMsg\n
return printed\n
obj.setGroup(person.getSubordinationValue().getGroup())\n
obj.setGroup(gr)\n
obj.manage_setLocalRoles(person.getReference(),[\'Owner\',])\n
context.DMS_notifyByEmail(address=senderemail,event=\'ingest\',object=obj)\n
except Exception,e:\n
return str(e)\n
context.log_traceback(context)\n
raise\n
#return str(e)\n
return\n
......@@ -192,7 +194,6 @@ return\n
<string>gr</string>
<string>Exception</string>
<string>e</string>
<string>str</string>
</tuple>
</value>
</item>
......
......@@ -92,7 +92,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>user=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -112,12 +112,14 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple/>
<tuple>
<string>user</string>
</tuple>
</value>
</item>
</dictionary>
......@@ -128,7 +130,9 @@
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
......
420
\ No newline at end of file
422
\ 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