I want to mark several Dexterity content types (from different packages) with an interface provided by another package. On their own they do not need to implement the interface so it is best that the marking is done in a policy package. I expected to be able to do it via the following ZCML directives:
However, this will not take effect since the referred classes are schema interfaces. My solution then is to create a custom object class.
from plone.dexterity.content import Container
from plone.supermodel import model
class IMyApplication(model.Schema):
....
class MyApplication(Container):
"""
Booking application object class
"""
Is this the correct way or am I missing something about schema classes?
I know that I can also do this via a behavior and do the marking via generic setup type tool.
I am implementing an applications center where app containers will be displayed. Since not all apps are meant to be collected by the application center, I would like to mark the selected ones with an interface in a policy package.
I first tried using ZCML directives for it but as I found out, I can not refer to schema classes to apply my marker interface. Dexterity objects are either Item or Container types by default so if I want to use the ZCML route, I will have to customize a class for each of my app that inherits from Dexterity Item or Container. I just wanted to know if there was an easier way to do it since I have several apps already.
My solution is to use behaviors to apply the marker interface. I am adding the behavior from the types tool of my policy package. I just do not like that the behavior shows up in the Dexterity Behaviors control panel.