My doubt is: how the final code should be to work with these scenarios? I think I made it work with the first and last use case, but when I use Plone 4.3 with just Dexterity I can't make it work.
we have different types of tiles (basic, carousel, list, rich text…) and every time a user drops/moves content or edits/deletes one of them, we need to update the list of references to make link integrity work.
Link integrity feature seems not to be working neither in Plone 4.2, nor in Plone 4.3 with plone.app.contentypes installed.
can someone of the FT help debugging this?
this is the code we are using:
if PLONE_VERSION.startswith('5'):
from plone.app.linkintegrity.handlers import updateReferences
else:
from plone.app.linkintegrity.handlers import referencedRelationship
from plone.app.linkintegrity.references import updateReferences
from Products.Archetypes.interfaces import IReferenceable
...
def update_link_integrity(obj, event):
"""Update link integrity information on modification/removal of tiles."""
refs = obj.get_referenced_objects()
# needs plone.app.referenceablebehavior enabled in cover content type
if PLONE_VERSION.startswith('5'):
updateReferences(obj, refs)
else:
adapted = IReferenceable(obj, None)
if adapted is None:
return
updateReferences(adapted, referencedRelationship, refs)
Recently, I discovered an additional problem with older versions of "plone.app.linkintegrity": they patch the standard Zope error handling ("Zope2.App.startup.zpublisher_exception_hook") and thereby break logging and counting of unresolved "ConflictError" exceptions: those exceptions are no longer logged nor counted.
The problem is fixed in version 3.x - though, I do not know whether those versions work with Plone 4.
p.a.linkintegrity 3.x is for Plone 5 and higher only since it was a non-trivial change in functionality. I do not plan to backport that to Plone 4.x and it would never be merged in Plone 4.x. Nevertheless you are welcome to create a Plone-4.x-compatible branch of p.a.linkintegrity 3.x and use it in your projects.
Just for the record, in case someone having troubles and end up here via google:
I'm using Plone 4.3.7 with plone.app.contenttypes 1.1b5. To make link integrity work I had to:
Install plone.app.referenceablebehavior
Enable the IReferenceable behavior on all content types.
From this point on link integrity was already working, with one caveat: only for new content items. If I edit the item and save it, then it began to work too. To solve this I had to populate uid_catalog and reference_catalog. This is what the following script does: