[Zope-CMF] How add a new property to Factory-based Type Information?
Grégoire Weber
gregoire.weber@switzerland.org
Tue, 01 Oct 2002 17:38:01 +0200
Hi all!
I'd like be able to add a new property to the
'Factory-based Type Information' ZMI view of a content
type.
I'm able to add a property through the install script of my
product as followed (stripped down code snippet):
<CODE file="Install.py">
prop = {'id':'slots', 'type': 'string', 'mode':'w',
'label':'Available Slots'}
# 'xxx' is the meta_type of the content type
fti = getattr(getToolByName(self, 'portal_types'), 'xxx')
if not fti.hasProperty(prop['id']):
fti._properties = fti._properties + (prop,)
fti.manage_changeProperties( {prop['id']: 'foobar'} )
</CODE>
As said above: This works in 'Install.py' in the 'Extensions'
folder.
What I am searching for is a hook where I can add the additional
properties at the moment somebody adds a new portal type by
'Factory-based Type Information' in the portal_types tool.
I'd like to use 'Factory-based Type Information' of a content
type to differently configure cloned content types.
I took a look into the code TypesTool and I found out that there
could be such a hook in 'listDefaultTypeInformation':
package = getattr(Products, product.getId(), None)
dispatcher = getattr(package, '__FactoryDispatcher__', None)
ftis = getattr(dispatcher, 'factory_type_information', None)
How can I use 'dispatcher' and '__FactoryDispatcher__'.
Or am I on the wrong path?
Greetings, Greg
P.S.: Zope 2.5.1/CMF1.3 on Win2k
_____________________________________
Grégoire Weber
mailto:gregoire.weber@switzerland.org