Browser view for folders, and for other types

In my AJAX navigation add-on (PyPI package and Github present but currently not up-to-date) I have "@@ajax-nav" browser views which are intended to be different for

  • folders
  • all other content types.

(currently almost only Archetypes-based data).
However, with this ZCML:

<browser:page
   name="ajax-nav"
   for="Products.ATContentTypes.interfaces.IATContentType"
   class=".AjaxnavBaseBrowserView"
   permission="zope2.View"
   />

<browser:page
   name="ajax-nav"
   for="Products.ATContentTypes.interfaces.IATFolder"
   class=".folder.AjaxnavBrowserView"
   permission="zope2.View"
   />

... I get a zope.configuration.xmlconfig.ZopeXMLConfigurationError:

ZopeXMLConfigurationError: File "/opt/zope/common/eggs/Products.CMFPlone-4.3.3-py2.7.egg/Products/CMFPlone/configure.zcml", line 98.4-102.10
ZopeXMLConfigurationError: File "/opt/zope/instances/unitracc-devel/src/visaplan.plone.ajaxnavigation/src/visaplan/plone/ajaxnavigation/configure.zcml", line 30.2-30.30
ZopeXMLConfigurationError: File "/opt/zope/instances/unitracc-devel/src/visaplan.plone.ajaxnavigation/src/visaplan/plone/ajaxnavigation/views/configure.zcml", line 17.2-22.7
TypeError: multiple bases have instance lay-out conflict

Now what should I do, i.e.: What would be "best practice"?

  • Detect folders at runtime?
  • Is there a common non-folder interface to use?
  • Use a special layer for folder objects?
  • Any other options?

Maybe if helps if you use the interfaces from Products.CMFCore, as listed under common interfaces in the Plone documentation at: https://docs.plone.org/develop/addons/components/interfaces.html

Products.CMFCore.interfaces.IContentish

All content items on the site. In the site root, this interface excludes Zope objects like acl_users (the user folder) and portal_skins which might otherwise appear in the item listing when you iterate through the root content.

Products.CMFCore.interfaces.IFolderish

All folders in the site.

Here a folder also has both IContentish and IFolderish, but the error you get hints at some low level clash in the class inheritance tree when you use the Archetypes Interfaces.

Thank you; indeed I was wondering which set of interfaces to use.

Plone Foundation Code of Conduct