I created a custom view to display items in a Folder or Collection in a grid layout. Now I would like to take that same template and apply it to the Mosaic Content Listing tile in much the same way as Listing View, Summary View, and Tablular View work.
I read through this post from 2021 and figured out how to add a new entry to the Display Mode drop down when adding the Content Listing tile. Unfortunately when I select my entry, I get the following traceback.
2022-08-24 21:03:06,015 ERROR [Zope.SiteErrorLog:252][waitress-0] 1661374986.01512960.990146085812916 http://localhost:8080/site/test/test-folder/@@plone.app.standardtiles.contentlisting/f296fe4d16f04586a7d2e0b64ce0c274
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 371, in publish_module
Module ZPublisher.WSGIPublisher, line 266, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 63, in call_object
Module plone.app.standardtiles.contentlisting, line 137, in __call__
Module Products.Five.browser.pagetemplatefile, line 126, in __call__
Module Products.Five.browser.pagetemplatefile, line 58, in __call__
Module zope.pagetemplate.pagetemplate, line 133, in pt_render
Module Products.PageTemplates.engine, line 378, in __call__
Module z3c.pt.pagetemplate, line 176, in render
Module chameleon.zpt.template, line 302, in render
Module chameleon.template, line 215, in render
Module chameleon.utils, line 53, in raise_with_traceback
Module chameleon.template, line 192, in render
Module ac98c8f75fdff5ea195573b7b815814d, line 220, in render
Module zope.tales.pythonexpr, line 73, in __call__
- __traceback_info__: (view.contents())
Module <string>, line 1, in <module>
Module plone.app.standardtiles.contentlisting, line 196, in contents
Module zope.component._api, line 104, in getMultiAdapter
zope.interface.interfaces.ComponentLookupError: zope.interface.interfaces.ComponentLookupError: ((<plone.app.contentlisting.contentlisting.ContentListing object at 0x7f9c669d2910>, <WSGIRequest, URL=http://localhost:8080/site/test/test-folder/@@plone.app.standardtiles.contentlisting/f296fe4d16f04586a7d2e0b64ce0c274>), <InterfaceClass zope.interface.Interface>, 'grid_view')
- Expression: "python:view.contents()"
- Filename: ... plone/app/standardtiles/templates/contentlisting_view.pt
- Location: (line 22: col 32)
- Source: ... al:replace="structure python:view.contents()">Listing</div>
^^^^^^^^^^^^^^^^^^^^^^
- Arguments: template: <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x7f9c52e1eb50>
options: {}
args: ()
nothing: None
modules: <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter object at 0x7f9c60fce4c0>
request: <WSGIRequest, URL=http://localhost:8080/site/test/test-folder/@@plone.app.standardtiles.contentlisting/f296fe4d16f04586a7d2e0b64ce0c274>
view: <Products.Five.browser.metaconfigure.ContentListingTile object at 0x7f9c59610970>
context: <Folder at /site/test/test-folder>
views: <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x7f9c52eb4bb0>
here: <Folder at /site/test/test-folder>
container: <Folder at /site/test/test-folder>
root: <Application at >
traverse_subpath: []
user: <PloneUser 'testuser'>
default: <DEFAULT>
repeat: <Products.PageTemplates.engine.RepeatDictWrapper object at 0x7f9c5a830580>
loop: {}
target_language: None
translate: <function BaseTemplate.render.<locals>.translate at 0x7f9c58157160>
attrs: {}
I have poked around in the plone.app.standardtiles code and tracked the error to the ContentListingTile.contents() method and in particular the call to getMultiAdapter
, but this is where I am stuck.
I suspect I need to register an adaptor or interface so the ContentListing object knows how to reference my grid_view
template, but I have no idea how to go about doing that.