Skip to content

Commit

Permalink
The ILeadImage inherits from IImageScaleTraversable to enable the ima…
Browse files Browse the repository at this point in the history
…ges view

Fixes #576
  • Loading branch information
ale-rt committed Dec 12, 2020
1 parent 020106a commit 1d28f3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions news/576.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ILeadImage inherits from IImageScaleTraversable to enable the images view
4 changes: 2 additions & 2 deletions plone/app/contenttypes/behaviors/leadimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.namedfile import field as namedfile
from plone.namedfile.interfaces import IImageScaleTraversable
from plone.supermodel import model
from zope import schema
from zope.component import adapter
from zope.interface import implementer
from zope.interface import provider
from zope.interface import Interface


class ILeadImage(Interface):
class ILeadImage(IImageScaleTraversable):
pass


Expand Down
10 changes: 8 additions & 2 deletions plone/app/contenttypes/tests/test_behaviors_leadimage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from plone.app.contenttypes.behaviors.leadimage import ILeadImage
from plone.app.contenttypes.interfaces import IPloneAppContenttypesLayer
from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FUNCTIONAL_TESTING # noqa
from plone.app.testing import setRoles
Expand Down Expand Up @@ -33,8 +34,6 @@ def setUp(self):
self.fti = fti
alsoProvides(self.portal.REQUEST, IPloneAppContenttypesLayer)
alsoProvides(self.request, IPloneAppContenttypesLayer)
from plone.app.contenttypes.behaviors.leadimage import ILeadImage
alsoProvides(self.request, ILeadImage)
self.portal.invokeFactory(
'leadimagefolder',
id='leadimagefolder',
Expand Down Expand Up @@ -79,3 +78,10 @@ def test_lead_image_viewlet_shows_up(self):
# But doesn't show up on folder_contents, which is not a default view
self.browser.open(self.portal_url + '/leadimagefolder/folder_contents')
self.assertTrue('<div class="leadImage">' not in self.browser.contents)

def test_lead_image_enables_images_view(self):
self.portal.invokeFactory('leadimagefolder', id='foo')
self.assertTrue(ILeadImage.providedBy(self.portal.foo))
self.assertIsNotNone(
self.portal.foo.restrictedTraverse("@@images", None)
)

0 comments on commit 1d28f3d

Please sign in to comment.