[Zope-CMF] Re: Metatype() standard?

Florent Guillaume fg at nuxeo.com
Thu Mar 11 11:23:22 EST 2004

In article <E2072220-6E41-11D8-8DF1-0030656A1306 at bowery.com> you write:
> OK, this is getting more tangled.  Is there any good documentation for 
> coding practices regarding this stuff?

Well apart from the code and the HISTORY.txt note I wrote that you
found... And the archives of the list... :)

> I found the definition of getPortalTypeName in DynamicTypes.py - does 
> this mean that if you're making a portal type you should mix in 
> DynamicType?  Because e.g. I don't think Archetypes is doing this (at 
> least not that I find...)

getPortalTypeName is a convenience method, but I think there's so much
code using the portal_type attribute directly that you can use it
regardless too. However getPortalTypeName is used in several other
places in the code (WorkflowTool for instance) so I guess it's a
required method.

> The interface in portal_types.py does not have getPortalTypeName, but 
> it does have getTypeInfo, which looks like if you pass an object and 
> then access it's Id (e.g. here.portal_type.getTypeInfo(here).getId() ) 
> then you'd get the same thing?

Yeah but slower. The fact that context.getPortalTypeName() ==
context.getTypeInfo().getId() is actually an invariant.

I really think DynamicType should be mixed in to all CMF content objects


Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg at nuxeo.com

More information about the Zope-CMF mailing list