Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/1875.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed block deserializers not running for control panel fields @JeffersonBledsoe
8 changes: 6 additions & 2 deletions src/plone/restapi/deserializer/controlpanels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
from zope.schema import getFields
from zope.schema.interfaces import ValidationError

from plone.restapi.behaviors import IBlocks
from Acquisition import ImplicitAcquisitionWrapper

@implementer(IDexterityContent)

@implementer(IDexterityContent, IBlocks)
class FakeDXContext:
"""Fake DX content class, so we can re-use the DX field deserializers"""

Expand Down Expand Up @@ -44,6 +47,7 @@ def __call__(self, mask_validation_errors=True):

# Make a fake context
fake_context = FakeDXContext()
wrapped_context = ImplicitAcquisitionWrapper(fake_context, self.context)

for name, field in getFields(self.schema).items():
field_data = schema_data.setdefault(self.schema, {})
Expand All @@ -53,7 +57,7 @@ def __call__(self, mask_validation_errors=True):

if name in data:
deserializer = queryMultiAdapter(
(field, fake_context, self.request), IFieldDeserializer
(field, wrapped_context, self.request), IFieldDeserializer
)

try:
Expand Down