Commit 4d8aec2c authored by Ivan Tyagov's avatar Ivan Tyagov

Removed uneeded condition. Show error message to user.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14831 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f203bbac
...@@ -90,32 +90,26 @@ if contribute_file is not None:\n ...@@ -90,32 +90,26 @@ if contribute_file is not None:\n
# We want to discover metadata synchronously\n # We want to discover metadata synchronously\n
kw[\'discover_metadata\'] = 0 \n kw[\'discover_metadata\'] = 0 \n
\n \n
if 1:\n editable_mode = 1\n
editable_mode = 1\n file_name = getattr(contribute_file, \'filename\', None)\n
file_name = getattr(contribute_file, \'filename\', None)\n # try to ingest file\n
# try to ingest file\n try:\n
try:\n new_content = context.portal_contributions.newContent(**kw)\n
new_content = context.portal_contributions.newContent(**kw)\n merged_content = new_content.discoverMetadata(file_name=file_name)\n
merged_content = new_content.discoverMetadata(file_name=file_name)\n except Exception, e:\n
except Exception, e:\n # there are errors during ingestion content\n
# there are errors during ingestion content\n msg = \'There was a problem during ingestion: ${exception}. Please try again later.\'\n
msg = \'There was a problem during ingestion. Please try again later.\'\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
# successful ingestion, show appropriate message\n
if 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
else:\n
msg = \'There was a problem: ${exception}\'\n
msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n
target = context\n return context.Base_redirect(\'WebSite_viewAsSCALE\', \n
editable_mode = 0\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
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 \n
return target.Base_redirect(\'view\', \n return target.Base_redirect(\'view\', \n
keep_items=dict(portal_status_message=msg, \n keep_items=dict(portal_status_message=msg, \n
...@@ -181,8 +175,8 @@ return target.Base_redirect(\'view\', \n ...@@ -181,8 +175,8 @@ return target.Base_redirect(\'view\', \n
<string>e</string> <string>e</string>
<string>msg</string> <string>msg</string>
<string>dict</string> <string>dict</string>
<string>target</string>
<string>str</string> <string>str</string>
<string>target</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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