[Zope-CMF] Registering content types with different add permissions in one module

Tres Seaver tseaver at zope.com
Tue Oct 21 15:09:48 EDT 2003


On Tue, 2003-10-21 at 15:13, Heimo Laukkanen wrote:
> Tres Seaver wrote:
> 
> > The first argument to the ContentInit contstructor is the "faux
> > metatype" (actually, the name which shows up in the ZMI add list).
> > You need to supply a different name for each distinct content type group
> > (which you are dividing by permissions).
> 
> I did. But as long as the content types were inside and initialized 
> inside same Product, it did not work. If I moved excatly same code to be 
> a separate product, it worked.
> 
> Is this just CMF and Archetypes co-operation problem and if one would 
> like to solve it, where should they turn their eyes to?


I have a product for a customer whose init actually aggregates content
initializations (as a data strructure) from sub-pacakges of the product,
something like:


    counter = 0
    for permission, sub in aggregator.content.items():
        classes, extra_ctors = sub
        counter += 1

        ContentInit( 'Mega-Product Content %d' % counter
                   , content_types=tuple( classes )
                   , extra_constructors=tuple( extra_ctors )
                   , permission=permission
                   , fti=tuple( aggregator.ftis ) # XXX WAAAA!
                   ).initialize( context )


Note that comment:  I think (its been a while) that what is really being
stomped when you repeat a ContentInit registration within a product is
that the FTIs get stomped (they are normally stored, somewhat sneakily,
in the 'extra_contsructors' attribute of the product).

Trse.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com





More information about the Zope-CMF mailing list