[Zope-CMF] portal_types & meta type (Plone)

Tres Seaver tseaver@zope.com
05 Aug 2002 22:13:20 -0400


On Mon, 2002-08-05 at 20:47, Juan Pablo Romero wrote:
> Hi
> 
> I'm a little confused; Some docs (chapter 5 of ZWACK, etc) explicitly
> mention the posibility of changing the Meta type of an existing portal
> type. 
>
> Also, under which conditions is appropiated to change the Meta type? (I
> suppose there are some, otherwhise you wouldn't be able to change it).

If you set up a type from scratch, rather than using one of the
pre-registered versions, then you will need to set this value.

The "Metatype" field on a type info object *must* correspond *exactly*
to the metatype of the underlying Python class.

> So, what is the better way of "repurposing" the News Item type?
> (I need a object identical to the news item type, except that it could
> be displayed in its own box)

Create a second FactoryTypeInformation object, based on
CMFDefault.NewsItem, but give it a different ID, title, and
description;  instances of this type *won't* show up in the stock
'news_box' template, because their 'portal_type' (*not* 'meta_type')
won't match;  it will be the same as the ID of the type object.  You can
then create a different template, e.g. 'my_news_box', which filters for
that 'portal_type'.

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