Skip to content

Commit

Permalink
add some fix in order to work with plone 6.0.11 and it's dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-bellenghi committed May 2, 2024
1 parent a151be3 commit f9090ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/design/plone/contenttypes/restapi/serializers/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def __call__(self, force_all_metadata=False, force_images=False):

if self.is_get_call():
res["has_children"] = self.has_children()

if force_images:
# TODO: verificare se non c'è il campo o se il campo è null/vuoto ?
if not res.get("image_scales") and not res.get("image_field"):
Expand All @@ -198,7 +197,14 @@ def __call__(self, force_all_metadata=False, force_images=False):
res["image_field"] = "preview_image"
elif "image" in scales:
res["image_field"] = "image"

# plone.app.contentlisting 3.0.5 sembra fissare un accessor che ci
# fa arrivare uno scale senza image_field.
# avremmo questo problema una volta passati a plone 6.0.11
elif res.get("image_scales") and not res.get("image_field"):
if "preview_image" in res["image_scales"]:
res["image_field"] = "preview_image"
elif "image" in res["image_scales"]:
res["image_field"] = "image"
return res

def has_children(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def test_image_in_uo_serializer(self):
self.assertEqual(uo_children["image_field"], None)
# Plone 6.0.10.1 due to a bug in plone.app.contentlisting (#64
# from github issue) return None
# Plone 6.0.11 upgrade plone.app.contentlisting to a version
# fixing the problem
# Plone 6.0.11 upgrades plone.app.contentlisting to a version
# fixing the problem and the changing the return value to {}
self.assertIn(uo_children["image_scales"], (None, {}))

# now, add a preview image
Expand Down

0 comments on commit f9090ed

Please sign in to comment.