[Zope-CMF] Re: GenericSetup: allowed_container_types

yuppie y.2006_ at wcm-solutions.de
Thu Jan 5 06:05:14 EST 2006


Hi Florent!


Florent Guillaume wrote:
> 
> On 4 Jan 2006, at 20:17, Florent Guillaume wrote:
> 
>> On 13 Dec 2005, at 13:50, yuppie wrote:
>>> Florent Guillaume wrote:
>>>> On 13 Dec 2005, at 12:50, yuppie wrote:
>>>>>
>>>>> I'd propose to implement an update mode for list properties and to 
>>>>> add an update file for each allowed container. Something like that:
>>>>>
>>>>> <object name="MyContainer">
>>>>>  <property name="allowed_content_types">
>>>>>   <element value="MyType"/>
>>>>>  </property>
>>>>> </object>
>>>>>
>>>>> (Didn't have a look at the code. I guess this currently overwrites 
>>>>> the list and maybe that's what it should do by default. But we 
>>>>> could add an explicit mode="update" to enforce an update mode.)
>>>> Yes that was another option I'd considered but found more complex, 
>>>> but if you think it's ok I'll look at how to implement it.
>>>
>>> Yes, I prefer this option. It should be easy to implement and also 
>>> useful for other properties. Workflow bindings are set in a similar 
>>> way, see the example in the CMFTopic profile.
>>>
>>>> The mode="update" would be an attribute of <property>, right ?
>>>
>>> Yes. But just found that I already use purge="False" for action 
>>> handlers. I guess this is better than mode="update".
>>
>> I can't find any code for purge="False".

This is only on the trunk. The _importNode methods of 
ActionCategoryNodeAdapter and ActionNodeAdapter look for an optional 
'purge' attribute.

>>> Workflow bindings don't need that attribute - they are always in 
>>> update mode if self.environ.shouldPurge() is False. Maybe it would be 
>>> better to make the shouldPurge setting the default for properties as 
>>> well. And override it with purge="True" if necessary. Don't know.
>>
>> On the other hand the object importer and the skins layer importer 
>> check insert-before and insert-after. I'll reuse that, even if in my 
>> use case the list order doesn't matter.
> 
> On second thought it's a bit different, for skins and objects 
> insert-before and insert-after are attributes of the (equivalent of the) 
> element itself, not the property...
> 
> So I'll put them on the elements, and make update the default if purge 
> is true, and add an optional purge="True" on the property if you really 
> want to purge it in an extension profile.

And on third thought you implemented remove="True". I'm not married to 
'purge', but

- we should be consistent for all kinds of sequences

- remove doesn't feel right. If I see
   <property name="lines2" remove="True">
   I expect this property will be removed, not just cleared.

- it actually overrides shouldPurge()


BTW: We should document these update directives somewhere. Originally 
all update directives were mentioned in CMFSetup/PROFILES.txt. 
GenericSetup/PROFILES.txt no longer has a complete list because most 
update directives are CMF specific.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list