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
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.
it's not clear what are you trying to do and why are you trying to do it.
something is really broken if your content type don't need to implement it's own schema: just edit the schema and change it to reflect what you need.
if you need extra fields use behaviors.
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.
that's a completely different issue and the "right" question to ask here is probably: how to hide a behavior from the behavior listing?
possibly related with:
Thanks, you answered my next question.
It is good to be informed ahead that there is a current bug. I would have spent some time debugging this myself.