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

Tres Seaver tseaver at zope.com
Tue Oct 21 14:49:13 EDT 2003


On Tue, 2003-10-21 at 08:51, Heimo Laukkanen wrote:
> Hi ya,
> 
> I need to register new types into Portal, but would need different add 
> permissions for different types. I have all my content types created 
> with Archetypes in content.py, which is in MyProject directory.
> 
> How can I register some of these types with one permission and rest of 
> them with another? I tried to do second ContentInit.initialize call with 
> just a few of the types - but it wiped out types that I registered 
> beforehand.
> 
> There must be some solution?
> 
> def initialize(context):
>      import content
>      content_types, constructors, ftis = process_types(
>          listTypes(PROJECTNAME),
>          PROJECTNAME)
>      utils.ContentInit(
>          PROJECTNAME + ' Content',
>          content_types      = content_types,
>          permission         = ADD_CONTENT_PERMISSION,
>          extra_constructors = constructors,
>          fti                = ftis,
>          ).initialize(context)

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).

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





More information about the Zope-CMF mailing list