Commit 40448c29 authored by Yusei Tahara's avatar Yusei Tahara

2007-12-21 Yusei

* Update file contribution part. Please update erp5_web and erp5_dms together.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18472 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cc5f6a48
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -73,10 +70,7 @@
contribute widget.\n
\n
**kw -- remaining params passed to the constructor\n
\n
TODO: rename source_project to follow_up (everywhere)\n
"""\n
\n
from Products.ERP5.Document.Document import ConversionError\n
from xmlrpclib import Fault\n
from socket import error as SocketError\n
......@@ -95,15 +89,19 @@ if contribute_file is not None:\n
kw[\'file\'] = contribute_file\n
\n
# We want to discover metadata synchronously\n
kw[\'discover_metadata\'] = 0 \n
kw[\'discover_metadata\'] = 0\n
\n
editable_mode = 1\n
file_name = getattr(contribute_file, \'filename\', None)\n
# try to ingest file\n
failure = 0\n
new_content = None\n
merged_content = None\n
\n
try:\n
new_content = context.portal_contributions.newContent(**kw)\n
merged_content = new_content.discoverMetadata(file_name=file_name)\n
new_content.processFile()\n
merged_content = new_content.Document_convertToBaseFormatAndDiscoverMetadata(file_name=file_name)\n
except ConversionError, Fault:\n
# there are errors during ingestion content\n
failure = 1\n
......@@ -116,21 +114,29 @@ except (TypeError, KeyError, AttributeError):\n
# there\'s an unknow error occured\n
failure = 1\n
msg = \'Sorry, unknow error occured.\'\n
\n
\n
target = None\n
if merged_content is not None:\n
target = merged_content\n
elif new_content is not None:\n
target = new_content\n
else:\n
target = context\n
\n
if failure:\n
msg = context.Base_translateString(msg)\n
return context.Base_redirect(\'WebSite_viewAsSCALE\', \n
keep_items=dict(portal_status_message=msg,\n
editable_mode=0))\n
return target.Base_redirect(\'WebSite_viewAsSCALE\',\n
keep_items=dict(portal_status_message=msg,\n
editable_mode=0))\n
# successful ingestion, show appropriate message\n
if merged_content is not new_content:\n
if merged_content is not None and merged_content is not new_content:\n
msg = context.Base_translateString(\'Document successfully updated\')\n
target = merged_content\n
else:\n
msg = context.Base_translateString(\'Document successfully created\')\n
target = new_content\n
\n
return target.Base_redirect(\'view\', \n
return target.Base_redirect(\'view\',\n
keep_items=dict(portal_status_message=msg, \n
editable_mode=editable_mode))\n
</string> </value>
......@@ -193,17 +199,17 @@ return target.Base_redirect(\'view\', \n
<string>getattr</string>
<string>file_name</string>
<string>failure</string>
<string>new_content</string>
<string>merged_content</string>
<string>_apply_</string>
<string>_getattr_</string>
<string>context</string>
<string>new_content</string>
<string>merged_content</string>
<string>msg</string>
<string>TypeError</string>
<string>KeyError</string>
<string>AttributeError</string>
<string>dict</string>
<string>target</string>
<string>dict</string>
</tuple>
</value>
</item>
......
2007-12-21 Yusei
* Update file contribution part. Please update erp5_web and erp5_dms together.
2007-11-28 Yusei
* Remove hardcoded ingestion email address from WebSite_viewContributeRenderer. Please use Email Ingestion Address preference instead.
......
609
\ No newline at end of file
611
\ 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