Skip to content

Recycle bin: Can't restore item if it's original container no longer exists #4171

@davisagli

Description

@davisagli

This is a bug found while testing #4168

Steps to reproduce:

  1. Add a folder.
  2. Add a page inside the folder.
  3. Delete the page.
  4. Delete the folder.
  5. In the main recycle bin view, try to restore the page.

Expected: There should be a status message saying the item can't be restored because its original container no longer exists, and that you have to go to the individual item in the recycle bin to specify where to restore. (OR there should be a special form to immediately choose the new location.)
Actual: There's an error with a traceback:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 390, in publish_module
  Module ZPublisher.WSGIPublisher, line 284, in publish
  Module ZPublisher.mapply, line 98, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module z3c.form.form, line 238, in __call__
  Module Products.CMFPlone.browser.recyclebin, line 39, in update
  Module z3c.form.form, line 233, in update
  Module plone.app.z3cform.csrf, line 21, in execute
  Module z3c.form.action, line 99, in execute
  Module z3c.form.button, line 312, in __call__
  Module z3c.form.button, line 167, in __call__
  Module Products.CMFPlone.browser.recyclebin, line 60, in handle_restore
  Module Products.CMFPlone.recyclebin, line 471, in restore_item
  Module Products.CMFPlone.recyclebin, line 394, in _find_target_container
ValueError: Original parent container at /Plone/folder no longer exists. You must specify a target_container to restore this item.

Next I thought I'll try to use the option to specify a target container on the recycle bin item view.

Steps:

  1. Click to view the details for the page I deleted
  2. Enter /Plone as the target container (try to restore with the top level of the Plone site as the container)
  3. Click the "Restore item" button

Expected: The page is restored inside the Plone site, and the browser navigates to the restored page
Actual: There is a message 'Item 'page inside folder' successfully restored, but it wasn't restored. The browser navigated to the original path (/Plone/folder/page-inside-folder) which is a 404. The page is no longer in the recycle bin and has been lost.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions