I've created and registered different views for different content types. They are working ok but only for content types other than Image and File. I cannot make the View available for the Image content type.
There is no Layout menu at all for Images. Nonetheless the Views appear in /Plone/portal_view_customizations
:
Products.ATContentTypes.content.document.ATDocument
about-view (zope.publisher.interfaces.browser.IDefaultBrowserLayer)
Products.ATContentTypes.content.image.ATImage
camera-view (zope.publisher.interfaces.browser.IDefaultBrowserLayer)
But getAvailableLayouts
returns an empty list for the image and a non-empty list for the document:
>>> image.getAvailableLayouts()
[]
>>> image.getTypeInfo().getAvailableViewMethods(image)
('image_view', 'camera-view')
>>> page.getAvailableLayouts()
[('about-view')]
>>> page.getTypeInfo().getAvailableViewMethods(page)
('document_view', 'about-view')
The following call in getAvailableLayouts()
in Products.CMFDynamicViewFTI-4.0.5-py2.7.egg/Products/CMFDynamicViewFTI/browserdefault.py
returns None
view = zope.component.queryMultiAdapter((self, self.REQUEST),
zope.interface.Interface,
name='image_view')
Any hints how to register Views for Image and File?
The coding is similar for all my views and is reproduced here (examples for Document and Image):
In /browser/configure.zcml
<browser:page
for="Products.ATContentTypes.content.image.ATImage"
name="camera-view"
class=".camera_view.CameraView"
permission="zope2.View"
template="camera_view.pt"
/>
<browser:page
for="Products.ATContentTypes.content.document.ATDocument"
name="about-view"
class=".about_view.AboutView"
permission="zope2.View"
template="about_view.pt"
/>
In /browser/about_view.py
from Products.Five import BrowserView
class AboutView(BrowserView):
""" """
In /profiles/default/types/Document.xml
<object name="Document">
<property name="view_methods" purge="False">
<element value="about-view"/>
</property>
</object>
In /browser/camera_view.py
from Products.Five import BrowserView
class CameraView(BrowserView):
""" """
In /profiles/default/types/Image.xml
<object name="Image">
<property name="view_methods" purge="False">
<element value="camera-view"/>
</property>
</object>
In /profiles/default/types.xml
<object name="portal_types" meta_type="Plone Types Tool">
<object name="Document" meta_type="Factory-based Type Information with dynamic views"/>
<object name="Image" meta_type="Factory-based Type Information with dynamic views"/>
</object>