diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml index 7e6e593e1ccb943a22523096367fbdf0f8f37df5..5f23b447645944ed121c382ba343b8bf406948a7 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml @@ -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> diff --git a/bt5/erp5_web/bt/change_log b/bt5/erp5_web/bt/change_log index 2340629bde06797a6473d2f0ee98d3c08ea668fb..6dab10fc9a08003257af9d1518a06ef851a63f50 100644 --- a/bt5/erp5_web/bt/change_log +++ b/bt5/erp5_web/bt/change_log @@ -1,3 +1,6 @@ +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. diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision index b6fdfc3c05ab5626fdf5d37f39e35706f4f4a7fa..09bd682e66b027f08ea6e0b72278cab363b2a83a 100644 --- a/bt5/erp5_web/bt/revision +++ b/bt5/erp5_web/bt/revision @@ -1 +1 @@ -609 \ No newline at end of file +611 \ No newline at end of file