[Zope-CMF] Extending FTI.isConstructionAllowed
Wichert Akkerman
wichert at wiggy.net
Tue Jun 2 07:59:40 EDT 2009
Previously Wichert Akkerman wrote:
> I have a use case where I need to put additional restrictions on object
> creation, in particular I need to restrict the maximum depth of items
> inside of a container of a specific type. The ideal place to put such a
> restriction seems to be the isConstructionAllowed method on the FTI.
> Currently this method is not very extensible, which leads to complicated
> code in various FTI types.
>
> I am considering to add an extension point here, something like this:
>
> class ITypeConstructionFilter(Interface):
> def __init__(fti, container):
> """Adapt on the FTI of the object being created and the target
> container"""
>
> def allowed():
> """Check if construction is allowed."""
>
>
> current checks such as the workflow check that was added in CMF 2.2, or
> the type constraint logic Plone has in ATContentTypes could be moved to
> such an adapter. The standard isConstructionAllowed method could then
> query all registered adapters to check if construction should be possible.
I have implemented this on the wichert-constructionfilter branch of
Products.CMFCore. I intend to merge this to trunk end of this week.
Wichert.
--
Wichert Akkerman <wichert at wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
More information about the Zope-CMF
mailing list