[Zope-CMF] One CMF object as an attribute of another, and getTypeInfo()

Dieter Maurer dieter@handshake.de
Mon, 14 Jul 2003 00:34:07 +0200


Jean-Francois.Doyon@CCRS.NRCan.gc.ca wrote at 2003-7-11 18:55 -0400:
 > I just created a CMF object type that has as an attribute an instance of a
 > CMF Portal Image, and as far as loading the image and viweing it, everything
 > works great.
 > 
 > Then I realized I actually need to keep DC metadata on that image.  The
 > metadata_edit_form actually works to look at it (Meaning the DC methods are
 > available), but I can't seem to edit it.
 > 
 > The metadata_edit script dies with:
 > 
 > AttributeError: 'None' object has no attribute 'getActionById' 
 > 
 > 'None' comes from the getTypeInfo method ... I'm now stuck trying to figure
 > out why that doesn't work, and how to fix it.

Give your "image" attribute a "portal_type" (for an existing CMF type).

 > After reading the docstring for getTypeInfo in TypesTool, I tried adding the
 > portal_type attribute by doing something like "
 > self.featuredimage.portal_type = 'Portal Image' ", but that didn't help.

You must use the id, the type has in "portal_types".


Dieter