Skip to content

Commit

Permalink
Merge pull request #134 from plone/fix-behavior-interfaces
Browse files Browse the repository at this point in the history
Fix changed behavior and marker interfaces for plone.leadimage and plone.richtext.
  • Loading branch information
thet authored Jan 5, 2024
2 parents d32f7f4 + d044b65 commit 259e160
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions news/133.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix changed behavior and marker interfaces for plone.leadimage and plone.richtext.
See: https://github.com/plone/plone.app.contenttypes/pull/480
[thet]
6 changes: 3 additions & 3 deletions src/plone/volto/browser/migrate_richtext.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from logging import getLogger
from operator import itemgetter
from plone import api
from plone.app.contenttypes.behaviors.leadimage import ILeadImage
from plone.app.contenttypes.behaviors.leadimage import ILeadImageBehavior
from plone.app.textfield.value import RichTextValue
from Products.Five import BrowserView
from uuid import uuid4
Expand Down Expand Up @@ -102,7 +102,7 @@ def migrate_richtext_to_blocks(
blocks[uuid] = {"@type": "description"}
blocks_layout["items"].append(uuid)

if ILeadImage(obj, None) and ILeadImage(obj).image:
if ILeadImageBehavior(obj, None) and ILeadImageBehavior(obj).image:
uuid = str(uuid4())
blocks[uuid] = {"@type": "leadimage"}
blocks_layout["items"].append(uuid)
Expand Down Expand Up @@ -161,7 +161,7 @@ def get_blocks_from_richtext(


def types_with_blocks():
"""A list of content types with volto.blocks behavior"""
"""A list of content types with volto.blocks behavior."""
portal_types = api.portal.get_tool("portal_types")
results = []
for fti in portal_types.listTypeInfo():
Expand Down
4 changes: 2 additions & 2 deletions src/plone/volto/scripts/add_image_field_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
bin/instance -O Plone run scripts/add_image_field_metadata.py
"""
from plone import api
from plone.app.contenttypes.behaviors.leadimage import ILeadImageBehavior
from plone.app.contenttypes.behaviors.leadimage import ILeadImage
from plone.volto.behaviors.preview import IPreview
from plone.volto.scripts.utils import print_info

Expand All @@ -12,7 +12,7 @@
catalog = api.portal.get_tool("portal_catalog")

with api.env.adopt_roles(["Manager"]):
images = api.content.find(object_provides=ILeadImageBehavior.__identifier__)
images = api.content.find(object_provides=ILeadImage.__identifier__)
preview_images = api.content.find(object_provides=IPreview.__identifier__)

brains = images + preview_images
Expand Down

0 comments on commit 259e160

Please sign in to comment.