Products.cmfplone: plone.app.iterate - Deleting working copy leaves the original item locked

Created on 11 May 2016  路  3Comments  路  Source: plone/Products.CMFPlone

Environment: using buildout.coredev branch 5.1, Plone 5.1a2.dev0, plone.app.iterate 3.1.7.dev0

Steps to reproduce:

  • Create a Plone Site
  • Install plone.app.iterate
  • Create a page
  • Check-out the page
  • Delete the working copy

At this point if you go to the original item you'll see a message showing the item is locked. There's no way to unlock.

It happens because the right thing to do would be use the "cancel checkout" action, instead of deleting the working copy directly. However the possibility of deleting the working copy is open to the user, so it still counts as a bug.

review question

All 3 comments

Locally I fixed it by using the same mechanism used by plone.app.linkintegrity to prevent the deletion of referenced content items.

When the user tries to delete the working copy instead of the default confirmation pop-up a message is shown saying that the user cannot delete the working copy and pointing to the "cancel checkout" page.

Technically it means:

  • A subscriber is registered for IWorkingCopy, IObjectRemovedEvent.
  • The subscriber raises an exception IDeleteWorkingCopyError, which derived from OFS.ObjectManager.BeforeDeleteException
  • A view named index.html is registered for the context IDeleteWorkingCopyError. This view shows the message warning the working copy can't be deleted and offers a link to the @@content-cancel-checkout.

What do you think of this approach? Should I open a pull request?

can we have the same in Plone 4?

@hvelarde I think so. If the fix is implemented on plone.app.iterate then we can backport to the branch used in Plone 4.

On a side note: The main difference on Plone 5 is that the plone.app.iterate version used there incorporates plone.app.stagingbehavior. Putting this aside, you can use the current plone.app.iterate on Plone 4.3.x and ignore plone.app.stagingbehavior I do this and it works.

Was this page helpful?
0 / 5 - 0 ratings