Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plone site breaks if has an image field (filled) on it #164

Closed
sneridagh opened this issue Nov 8, 2024 · 3 comments
Closed

Plone site breaks if has an image field (filled) on it #164

sneridagh opened this issue Nov 8, 2024 · 3 comments

Comments

@sneridagh
Copy link
Member

Plone site does not implements IImageScaleTraversable, so the multiadapter lookup fails on images for it.

We could make implement the Plone site IImageScaleTraversable but I guess this is easier.

I've found that there is already an adapter that return the scales for the INavigationRoot but it has another name assigned?

  <browser:page
      allowed_attributes="scale tag"
      class=".scaling.NavigationRootScaling"
      for="plone.app.layout.navigation.interfaces.INavigationRoot"
      name="image_scale"
      permission="zope2.View"
  />

So I'd add the missing one on the right name:

  <browser:page
      allowed_attributes="scale tag"
      class=".scaling.NavigationRootScaling"
      for="plone.app.layout.navigation.interfaces.INavigationRoot"
      name="images"
      permission="zope2.View"
  />

@mauritsvanrees Do you know why it's under another name? It's only used once in all the core code: https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/browser/search.py#L301

PR incoming...

@davisagli
Copy link
Member

davisagli commented Nov 8, 2024

@sneridagh I can't reproduce this. I created a (classic UI) Plone site in buildout.coredev, added the lead image behavior to the Plone Site, and edited the portal to add a lead image. It displays correctly using the /@@images view, even without your proposed fix.

On the console, I can see that the portal has the right interface:

>>> IImageScaleTraversable.providedBy(app.Plone)
True

I can't figure out where it comes from though!

@davisagli
Copy link
Member

@sneridagh I can reproduce the error on demo.plone.org, and with volto core using the docker backend

demo-plone-org_backend.1.rohcqq7cjghy@worker04    | Traceback (innermost last):
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module ZPublisher.WSGIPublisher, line 391, in publish_module
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module ZPublisher.WSGIPublisher, line 285, in publish
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module ZPublisher.mapply, line 98, in mapply
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module ZPublisher.WSGIPublisher, line 68, in call_object
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module plone.rest.service, line 21, in __call__
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module plone.restapi.services, line 19, in render
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module plone.restapi.services.content.get, line 16, in reply
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module plone.restapi.serializer.site, line 97, in __call__
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module plone.restapi.serializer.dxfields, line 107, in __call__
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module plone.restapi.imaging, line 59, in get_original_image_url
demo-plone-org_backend.1.rohcqq7cjghy@worker04    |   Module zope.component._api, line 113, in getMultiAdapter
demo-plone-org_backend.1.rohcqq7cjghy@worker04    | zope.interface.interfaces.ComponentLookupError: ((<PloneSite at /Plone used for /Plone>, <WSGIRequest, URL=http://demo-plone-org_backend:8080/Plone/++api++/GET_application_json_>), <InterfaceClass zope.interface.Interface>, 'images')

@davisagli
Copy link
Member

I can reproduce it with volto + Plone 6.0.13, but not volto + 6.1.b1. I'm not sure what change explains this, but it seems it was already fixed somehow.

@davisagli davisagli closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants