[Zope-CMF] new portal_type

Tres Seaver tseaver@zope.com
09 Jul 2002 10:59:18 -0400


On Tue, 2002-07-09 at 10:38, Jim Pharis wrote:
> On Tue, 2002-07-09 at 06:50, Chris Withers wrote:
> > Jim Pharis wrote:
> > > 
> > > What I am trying to do is currently over my head but its never stopped
> > > me before. I would like to know if it is possible "theoretically" to
> > > create a Zope Product that adds itself as a content type to CMF
> > > portal_types without messing with the CMFCore or CMFDefault source.
> > 
> > Yes, it is :-)
> 
> I wasn't sure because I noticed that CMFTopic, even though it is
> separate from CMFCore and Default, it is still referred to inside of
> that source. Can you point me in the direction of any docs/help on doing
> this or will it just take some good ol' fashion brute force hacking. 
> 
> > 
> > > I have successfully added a CMFmyOwnFolder that can create a regular
> > > folder but I need to implement it by creating a new Factory-Based Type
> > > Information which I don't want to do.
> > 
> > Why not? You should have TypeInformation objects for each of your content types.
> > Is there a reason why you don't want to do this?
> > 
> 
> I want my product to add itself as a content type automatically without
> distributing an implementation of CMF or having the user do it by hand.
> Thats what I mean by not having the user needing to create a new
> Factory-Based Type.

Can't be done, by design.  The "canonical" way to do this is to create
a script for an ExternalMethod and distribute it in the Extensions
directory of your product;  the site manager installs your product in
a given CMFSite by running this method.

Chris McDonough points out to me a feature of Zope Products:  any
'__methods__' in the product's '__init__' are made implicitly available
to all folders;  one might leverage this to make it possible to run the
installation without first creating an ExternalMethod object for each
add-on product.

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