plone / plone.app.tiles

Plone UI integration for plone.tiles
http://pypi.python.org/pypi/plone.app.tiles
Other
6 stars 7 forks source link

Fix getting original image in images/download/display-file view #46

Closed mauritsvanrees closed 2 years ago

mauritsvanrees commented 2 years ago

Calling tile/@@images/image/preview works. But what about getting the original image, with tile/@@images/image? For some custom tiles I have, this does not work, giving a NotFound error. With the demo tile from demo.py this does work. Why? Because it has explicitly defined an image property and this makes it work. I did not know this was needed, and ideally it should not be. This PR fixes it to work both with and without such a property.

The @@download and @@display-file views did not work at all, also not for the demo tile. You get an Unauthorized because you are not allowed to access the image property. I tried fixing this with security declarations, but could not get it to work. This PR registers the two views specifically for persistent tiles, and makes them work by getting the image from the tile data. This works in both cases. If this fails anyway, we fall back to the original code. I expect this gives an Unauthorized, but maybe someone has a tile where this is setup correctly.

I added tests to cover all uses.

Rudd-O commented 2 years ago

This looks fine to me, but please do note that I am not entirely knowledgeable about this area.

mauritsvanrees commented 2 years ago

Released as 3.3.0.