jensens
(Jens W. Klein)
March 8, 2017, 11:11am
1
We have a project where we have several relations to other content (custom behavior, some fields very similar to related items). So this is not in TinyMCE as links (content).
So I would like to make plone.app.linkintegrity
aware of this relations and if one deletes content references somewhere it should warn.
Is there already a solution around for this? Any hints what to do in order to implement it?
hvelarde
(hvelarde)
March 8, 2017, 1:23pm
2
are you talking about Plone 5? IIRC, you refactored link integrity to be a UI feature.
A few days ago Fred fixed the 1.5.x branch to not require plone.directives (grok) for dexterity support, so I wonder if that might affect you: https://github.com/plone/plone.app.linkintegrity/pull/49
But what you probably need to do, is change the event handlers to not only look for the isReferencing
relationship, but also for others:
from zc.relation.interfaces import ICatalog
from zope.component import getUtility
from zope.component.interfaces import ComponentLookupError
from zope.intid.interfaces import IIntIds
from zope.keyreference.interfaces import NotYet
from zope.publisher.interfaces import NotFound as ztkNotFound
from .compat import IBaseObject
import logging
logger = logging.getLogger(__name__)
referencedRelationship = 'isReferencing'
def findObject(base, path):
""" traverse to given path and find the upmost object """
if path.startswith('/'):
# Make an absolute path relative to the portal root
obj = getToolByName(base, 'portal_url').getPortalObject()
portal_path = obj.absolute_url_path() + '/'
if path.startswith(portal_path):
path = path[len(portal_path):]
jensens
(Jens W. Klein)
March 9, 2017, 8:23am
4
@mauritsvanrees thanks for the pointer!
thet
(Johannes Raggam)
April 4, 2017, 1:25pm
5
This PR addresses this issue:
2 Likes