Commit 79e6864d authored by Bartek Górny's avatar Bartek Górny

Call the right script in Contribution, and handle exceptions in it.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13167 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ab4ad8f2
...@@ -72,16 +72,20 @@ ...@@ -72,16 +72,20 @@
A method invoked with parameters provided by the \n A method invoked with parameters provided by the \n
contribute widget\n contribute widget\n
"""\n """\n
res = context.portal_contributions.newContent(**kw)\n try:\n
after_method_id = kw.get(\'after_method_id\')\n res = context.portal_contributions.newContent(**kw)\n
if after_method_id:\n after_method_id = kw.get(\'after_method_id\')\n
after_method = getattr(res, after_method_id)\n if after_method_id:\n
after_method() # if not found will raise exception, as it should\n after_method = getattr(res, after_method_id)\n
after_method() # if not found will raise exception, as it should\n
msg = context.Base_translateString(\'Document successfully created\')\n
target = res\n
except Exception, e:\n
msg = \'There was a problem: ${exception}\'\n
msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n
target = context\n
\n \n
# XXX Translation and Base_redirect\n return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg))\n
doc_url = res.absolute_url()+\'/view?portal_status_message=Document+created\'\n
\n
return context.REQUEST.RESPONSE.redirect(doc_url)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -133,7 +137,12 @@ return context.REQUEST.RESPONSE.redirect(doc_url)\n ...@@ -133,7 +137,12 @@ return context.REQUEST.RESPONSE.redirect(doc_url)\n
<string>after_method_id</string> <string>after_method_id</string>
<string>getattr</string> <string>getattr</string>
<string>after_method</string> <string>after_method</string>
<string>doc_url</string> <string>msg</string>
<string>target</string>
<string>Exception</string>
<string>e</string>
<string>dict</string>
<string>str</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<input type="submit" name="Memo_makeOOoTemplate:method" value="Make Template" id="maketemplatebutton" disabled="disabled"\n <input type="submit" name="Memo_makeOOoTemplate:method" value="Make Template" id="maketemplatebutton" disabled="disabled"\n
style="width:100px;background-image:none;"/>\n style="width:100px;background-image:none;"/>\n
&nbsp;\n &nbsp;\n
<input type="submit" name="WebSite_contributeFile:method" value="Contribute"/>\n <input type="submit" name="WebSite_contributeContent:method" value="Contribute"/>\n
</div>\n </div>\n
\n \n
\n \n
......
532 534
\ 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