Commit 25ad4056 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[renderjs_ui + json_style] Deletion of an object returns meaningful response

parent 1100aa14
from ZODB.POSException import ConflictError
"""Delete object - this script is called as the last frontier thus its result
gets printed into response body.
"""
some duplicated code with Folder_delete instead of modify Folder_delete
intended to make code easy understanding
The code is a modified version of Folder_delete. We split into two files not to
further complicate the mentioned script.
"""
portal = context.getPortalObject()
from ZODB.POSException import ConflictError
portal = context.getPortalObject()
translate = portal.Base_translateString
if context.isDeletable(check_relation=True):
parent = context.getParentValue()
......@@ -16,10 +18,16 @@ if context.isDeletable(check_relation=True):
portal.portal_workflow.doActionFor(context, 'delete_action')
else:
parent.manage_delObjects(ids= [context.getId()])
return
# redirect back to the container since the context was deleted
return container.Base_redirect(
keep_items={
"portal_status_message": translate("Document deleted")
})
except ConflictError:
raise
except Exception:
# XXX Catch-them-all expression is never a good idea
pass
request = portal.REQUEST
......
......@@ -176,21 +176,20 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tr>
<td>waitForTextPresent</td>
<td>deleted</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>deleted</td>
<td></td>
</tr>
<!-- Deletion of a Foo Document will still show it in Module View but with "deleted" state -->
<tr><td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_list.html')]//div[@data-gadget-scope="field_listbox"]//a[text()="deleted"]</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<!-- We should see only one Foo Document -->
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_list.html')]//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_list.html')]//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td>
......
......@@ -35,7 +35,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>verifyElementPresent</td>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='field_my_title']//input</td>
<td></td>
</tr>
......
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