Recommended Approach for Marking Dexterity Content Type with New Interface

While working on a dexterity-based project, I needed one of my content types to support the collective .quickupload, marking it with the IQuickUploadCapable interface.

I am currently adding “tools” to the configure.zcml file:

`<class class="plone.dexterity.content.Container">      
     <implements interface="collective.quickupload.browser.interfaces.IQuickUploadCapable" />
 </class>`

Since my content type is a container, this works, however my first inclination was to use the grok style approach instead of declaring it in ZCML. What is the grok / agility way of telling my agility content type that it implements an extra interface, or should I stick with the current approach?

I also tried to add the interface as my behavior to my file profiles/default/types/my.dexterity.content.xml, but this did not work (I really did not expect its behavior to have a different purpose).

+5
source share
3 answers

Sean's answer is good. Another way is to create behavior and apply it. You need to register the behavior with:

<plone:behavior
    title="Quickupload"
    provides="collective.quickupload.browser.interfaces.IQuickUploadCapable"
    />

You can then add 'collect.quickupload.browser.interfaces.IQuickUploadCapable' to your behavior list in FTI.

Using your approach is not very good, because it means that all container-based Dexterity types get a marker interface, not just your type.

+4
source

IQuickUploadCapable mixin form.Schema ?

+2

, , .

pypi, .

grok, :

from collective.quickupload.browser.interfaces import IQuickUploadCapable
from plone.directives import form
class IMyContent(form.schema):
    grok.implements(IQuickUploadCapable)

!

, , , ( - ).

+1

All Articles