Open mauritsvanrees opened 11 months ago
"test_widget" of plone.app.relationfield fails as this is a low level test where relations are not fully postinitialized as they are for field parents that are subscribed to IIntIdAddedEvent and zope.lifecycleevent.IObjectModifiedEvent. Instead the test is just on the widgets data manager. Which is fine, but breaks if the z3c.relationfield RelationValue.isbroken checks not only RelationValue.to_id but also RelationValue.from_object. Checking RelationValue.from_object to decide if a relation is broken made sense to me from a higher level perspective. I proposed the change in z3c.relationfield while fixing the inspection of relations which produced false sets of broken and valid relations. But now with the failing test I think it is up to the (Plone) inspection code (plone.restapi and for Classic CMFPlone) and not up to the z3c.relationfield code, which should stay innocent about the relation source. I will create a reverting PR for z3c.relationfield .
explanation of the patch by @do3cc in https://github.com/plone/plone.app.relationfield/commit/a5b69d8e1ad66a7d3d71ad772a62346761371742#r14620521
PR https://github.com/zopefoundation/z3c.relationfield/pull/25 to revert the change on RelationValue.isBroken
Looking at my old patch I see two mistakes:
But I don't feel comfortable creating PRs for code I don't use at all any more. I think @ksuess Code should work and my old monkey patch should return None instead of a KeyError if the dict does not contain a key "from_object"
We have a monkey patch that gives wrong results with latest
z3c.relationfield
, containing this PR by @ksuess.Let me copy my comment from a
buildout.coredev
PR where I try to updatez3c.relationfield
from 1.0 to 1.1. This breaks seven tests. All have the same source, a monkey patch fromplone.app.relationfield
. So maybe this monkey patch needs to be removed or adapted. Sample error from theplone.app.relationfield
tests themselves: