Closed wesleybl closed 1 year ago
This is a plone.restapi issue.
@cekk can you please take a look here? It seems that it was after the PR https://github.com/plone/plone.restapi/pull/953 that this error started to occur.
Using getRequest from zope.globalrequest instead of context.REQUEST should avoid this error (which happens if the object does not have a full acquisition chain to the Zope root)
@davisagli in fact, the classes that implement the interface don't even use request. For example:
So I wonder if the request could not be removed.
@wesleybl the request is useful as discriminators in the adaptors, as they allow overriding, per Plone site, the behavior, in case that's needed.
@tiberiuichim you mean through a layer? Adapter does not have the layer attribute. It is not possible to customize an adapter per site, through layer.
@wesleybl they don't have the layer, but the request will provide a marker layer interface. https://github.com/plone/bobtemplates.plone/blob/9bf1efef7c735ecec99d6e195aa5b10fa0e3dbfa/bobtemplates/plone/addon/src/+package.namespace+/+package.name+/profiles/default/browserlayer.xml.bob
@tiberiuichim are you proposing to customize the adapter and make an if in the custom adapter itself?
@wesleybl no... but I'm not sure I understand your last message correctly.
In any case, let me try explain:
directlyProvides
layer marker interfacesso you can register an override not by doing it via a configure-overrides.zcml, but you can do it in normal code, by using a more specific layer interface instead of IBrowserRequest
@tiberiuichim in that case, you would not overwrite the original. You would have one more subscriber on the site with the more specific interface. More specific interfaces only overwrite components that have the layer abribute.
I don't know if that's what you were looking for, I don't even know if it's worth keeping the request because of that.
@wesleybl I see now the issue, the adapters are actually subscribers.
Is anyone trying to fix this? Fastest fix would seem, as indicated above, to use getRequest
from zope.globalrequest
if self.context.REQUEST
is missing.
Whether the request is really needed/useful here seems a separate issue that we could talk about later.
Describe the bug If a Document has children, it is not possible to copy and paste this Document. We get the error:
To Reproduce Steps to reproduce the behavior:
Expected behavior Copy and paste works.
Software (please complete the following information):