[Zope-CMF] Re: modifying TypeInformation's properties
Tres Seaver
tseaver at zope.com
Sun Sep 5 19:24:31 EDT 2004
Julien Anguenot wrote:
> The problem for us is that we need to monkey patch all the time just to
> add a new property.
>
> Something like that :
>
> from Products.CMFCore.TypesTool import TypeInformation as FTI
>
> if 'cps_is_portlet' not in [prop['id'] for prop in FTI._properties]:
> FTI._properties = FTI._properties + (
> {'id':'cps_is_portlet', 'type': 'boolean', 'mode':'w',
> 'label':'CPS Portlet'},
> )
> FTI.cps_is_portlet = 0
>
> It wouldn't cost anything being able to extend the properties through a
> dedicated API. It doesn't add complexity at all, does it ?
At the moment, TypeInformation objects try *not* to allow extra
properties to be added. I think we could safely relax the constraint,
given a real use case (which CPS obviously has).
> We don't wanna create one TypeInformation just for that neither.
>
> I don't know much yet about CMFSetup and the possible issue though.
The configurator which dumps / loads type information objects could
probably be extended to handle extra properties, with elements like:
<properties>
<property name="a_property" type="string">Value here</property>
</properties>
Could one of the CPS guys look at adding that? If so, I would be glad
to entertain dropping the SimpleItemWithProperties bit (the only other
value it provides is being able to set a lable for the property).
>> Hi!
>>
>>
>> Florent Guillaume wrote:
>>
>>>> Maybe special kinds of types should have their own Type Information
>>>> class?
>>>
>>>
>>>
>>> Why ? The TypeInformation classes are implementation details about the
>>> type. The should not constrain how the TI is used, and should be
>>> interchangeable.
>>>
>>>> Factory-based Type Information and Scriptable Type Information are
>>>> made for ordinary content types.
>>>
>>> I don't know what you mean by that. They are made to construct CMF
>>> types.
>>
>>
>>
>> CMF *content* types. If I understand the concept of portlets right,
>> they are *presentation* objects. Sometimes its useful to use different
>> classes for different kinds of objects. Don't know if that's the best
>> solution in this case.
Portlets are "content" objects (like Topics), which have views that
enable easy inclusion in a bigger template.
Tres.
--
===============================================================
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the Zope-CMF
mailing list