I have a use case that I need to keep reference in my content type with other objects, and this package is used in many ways:
- Plone 4.3 with Archetypes and Dexterity
- Plone 4.3 with just Dexterity
- Plone 5.x with just Dexterity
I'm using plone.app.referenceablebehavior for Plone 4.3.
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.
Just a little bit of context; @rodfersou is working to fix link integrity in collective.cover and that implies taking care of objects referenced inside tiles.
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.
we are using a RF test as we moved that feature to the UI in Plone 5.
BTW, I found a couple of interesting links:
@thet @pbauer I'm in trouble to enable p.a.linkintegrity with Plone 4.3 and just Dexterity, could you guide me please on how to do it?
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:
from plone.app.linkintegrity.handlers import updateReferences
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
adapted = IReferenceable(obj, None)
if adapted is None:
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.
@pbauer our doubt is what is the preferred way to use p.a.linkintegrity in both Plone 4.x and Plone 5.x, and look if there are any examples on that.
There are already the version 1.5.x of p.a.linkintegrity that works on Plone 4.x. I tested manually this, and it is working with the code pasted here, also locally the tests pass without problems, but with travis it is not working.. maybe I miss something with our tests.. can someone review this test for us please? https://github.com/collective/collective.cover/blob/master/src/collective/cover/tests/test_link_integrity.robot
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: