[Zope-CMF] New product and meta_type and portal_catalog
Dieter Maurer
dieter@handshake.de
Mon, 2 Dec 2002 23:45:30 +0100
Pascal Samuzeau writes:
> I've creted a product, and I can't reach it with
> poartal_catalog.searchResults(meta_type='MyProduct'). It returns
> always []
>
> So, I've a lot of question :
>
> First I have in my product
>
> factory_type_information = ( { 'id' : 'IdProduct'
> , 'meta_type' : 'MyProduct' ... )
>
> and
>
> class MyProduct(SkinnedFolder, Item):
>
> meta_type = 'MyProduct'
> ....
>
> So, why do I need to have a double meta_type definition ?
In CMF, you have two layers:
1. the content class ("MyProduct") in your case
2. a set of types built upon the content class.
When you define a type you must specify the content
class used as base for the type.
Currently, this is a bit implicit. You specify
the class's "meta_type" (for filtering) and
the class's constructor (to create instances
of the type (and thereby the content class).
> In second stage, I think, if I'm not able to retrieve my Folder
> Product, It's because I don't inherit my class from another one, but
> which one do I need ?
Are you sure that "SkinnedFolder" is catalogued?
If it is, its "manage_afterAdd" and "manage_beforeDelete"
will call "indexObject" and "unindexObject".
Check for this.
Dieter