This package handles deleting an item in the Plone-User-interface (i.e.
deleting items in the view folder_contents via Actions / Delete).
Whenever an object that is referred to by another one via an <a> or <img>
tag is going to be deleted, a confirmation form is presented to the user.
They can then decide to indeed delete the object, breaching link
integrity of the site or first edit the objects that link to the item in
Refresh the linkintegrity site status
In the case you’ll need to update/refresh the linkintegrity status of the
whole site, you can call the @@updateLinkIntegrityInformation view.
It can be really slow operation.
To check if there would be breaches when deleting one or more objects
you can use the follwing code:
from plone import api
portal = api.portal.get()
view = api.content.get_view(
breaches = view.get_breaches([obj1, obj2])
get_breaches ignores breaches originating from any items that would also be
deleted by deleting the items (and their chidlren if an item is a folder).
Each breach in breaches is a dictionary with a target (a dict with some
info on the object to be deleted) and a list of sources.
Each source is again a dict with uid, title, url and accessible
(a boolean telling you if the user can access that source).
To check items for links in html-fields you can use the methods in
- Test if an object is linked to by other objects
- Test if an object links to other objects
- Return a generator of incoming relations
- Return a generator of outgoing relations
- Test if linkintegrity-feature is enables for users