What is the purpose of IPublishableThroughAcquisition in Plone 6?

We are currently in the process of porting our Plone 4 application to Plone 6, which involves using an IPublishTraverser.

Upon completing the traversal, we are faced with a NotFoundError exception.

zExceptions.NotFound
> /home/ajung/src/unibo/magazine-plone6/eggs/Products.CMFCore-3.2-py3.11.egg/Products/CMFCore/explicitacquisition.py(22)after_traversal_hook()
-> raise NotFound()

caused by this code:

PTA_ENV_KEY = "PUBLISHING_EXPLICIT_ACQUISITION"
SKIP_PTA = os.environ.get(PTA_ENV_KEY, "true") == "false"


@adapter(IPubAfterTraversal)
def after_traversal_hook(event):
    if SKIP_PTA or IPublishableThroughAcquisition.providedBy(event.request):
        return
    context = event.request["PARENTS"][0]
    if IShouldAllowAcquiredItemPublication(context, None) is False:
        raise NotFound()

Can someone shed some light on the purpose of IPublishableThroughAcquisition and the check related to the environment variable PUBLISHING_EXPLICIT_ACQUISITION?
Setting the environment variable to false may solve the problem, but I am uncertain about the potential drawbacks.

I'm sorry about this whole mess.

The intention is to have a hook so we can check for implictly acquired objects in publication, alike collective.explicitacquisition, including plone.rest support.

In Plone <=6 this is actively disabled: https://github.com/plone/Products.CMFPlone/blob/621edb0851967f033c40dae89ead14c8f4d4250d/Products/CMFPlone/__init__.py#L12-L21
This should be part of Products.CMFPlone 6.0.7 and plone.rest 4.1.0 .

Why this specific request triggers this, I can't tell, but setting the env var will not blow up anything.

By default, SKIP_PTA evaluates to False in Plone 6.0.7.
Is this the desired behaviour? With the current default (without having PUBLISHING_EXPLICIT_ACQUISITION set), this additional check is enabled by default. Is this correct?

SKIP_PTA should be true - at least starting with Plone 6.0.7

https://github.com/zopefoundation/Products.CMFCore/blob/be1c7590677b978bb9ccf6050b7de84b0d86235d/src/Products/CMFCore/explicitacquisition.py#L12-L13 assumes it needs to be on.
And then in Products.CMFPlone we turn it off again.

It's clearly False on my system when I use pdb directly on the module level :slight_smile:

I mean, yeah; I just don't understand why the Plone code didn't run/work/set SKIP_PTA

So the configuration code in explicitacquisition should be considered problematic?