[Zope-CMF] Portal types q

Tres Seaver tseaver@palladion.com
Mon, 18 Jun 2001 08:49:51 -0400


James van der Veen wrote:

> I have a uestion about the portal types wich are allways added to the CMF.
> It adds the News Item Folder etc etc. but I only want the News Item to be
> generated when I create a new Portal.
> So no one should be able to add a folder a image etc etc. How would you
> suggest I should do this. I guess I could set it at echt portal but since I
> have to make a lot this is not the best option (i think). I allso could just
> delete the other items in the python script so they will never be generated
> but this doesn´t seem like a good option since I do have other protals on
> the server wich use the other types.
> 
> I think I would want to choose at the setup wich of the standard types I
> want. Does anyone have any ideas on this or has someone done this already
> and could give me some hints?
> Sure hope so!


At DC, we have adopted a pattern in which we create an ExternalMethod,
to be run against a newly-created CMFSite, which does all the initial
configuration for a custom site.  In your case, it might delete all the
type objects except NewsItem, e.g.::

   def just_news( self )
       """
           We only want to add NewsItems on this site.
       """
       types = self.portal_types.listContentTypes()
       types.remove( 'News Item' )
       self.portal_types.manage_delObjects( types )

or something like that (in this case, it could even be a Python
Script, using 'context' in place of 'self').

Tres.
--
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org