[Zope-CMF] Is there a way to change the meta-type of a number of object types

Tres Seaver tseaver@palladion.com
Tue, 31 Jul 2001 08:22:21 -0400


Norman Khine wrote:

> Using the external method as described, does it mean, I can modify other
> attributes, just by including
> 
>  doc = brain.getObject()
>        doc.portal_type = 'Card'
> ---->  doc.review_state = 'published'
>        updated.append( doc )
> 
> if I want to make all these documents published, for example?


Yes, that is possible.  You might rather call the appropriate
workflow methods, however, as setting the attribute directly
breaks encapsulation;  for a one-time hack, it won't be too awful.


> Also, shouldn't portal_type be meta_type, as I am changing the meta_type
> from Document to Card?

If I understood your original question, you have created a new

type object, "Card", based against the CMFDefault.Document Python
class.  In this case, the 'meta_type' of the instances will still
be 'Document', but the 'portal_type' (the ID of the type objects)
will be 'Card'.  I can't think of any time when I would want to
set the 'meta_type' on an instance to be different from its class.

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