[Zope-CMF] Re: Abusing GenericSetup during traditional installs

yuppie y.2006_ at wcm-solutions.de
Thu Aug 17 09:50:13 EDT 2006


Hi Stefan!


Stefan H. Holek wrote:
> On 16. Aug 2006, at 18:18, yuppie wrote:
> 
>> AFAICS the catalog.xml in the profile is a normal catalog setup file. 
>> The default import step for this file should be registered and updates 
>> the catalog if all steps are run.
>>
> 
> Yes, the default machinery creates the UnicodeLexicons from catalog.xml 
> (using the adapter). This part works as expected.
> 
>> importUnicodeLexicon is a second import step for the same setup file. 
>> Looks like this step updates the catalog again. The thing that's 
>> different is the fact it reindexes the modified indexes.
>>
> 
>> Is that correct? What am I missing? What did not work with the default 
>> import step (besides reindexing)?
> 
> The second step is because extension profiles run in update-mode, and 
> already existing catalog indexes are not touched by the default 
> importers. Hence I need to do it by hand.

Ok, now I understand.

> Another complication is that 
> the index upgrade should happen only once, and not every time the 
> profile is applied. Nuxeo's upgrade extension could be useful here...

That's no general complication. There are migration use cases that are 
not well covered by GenericSetup, but your use case looks like the 
default use case for extension profiles. All handlers have to make sure 
that running them more than once doesn't change the result.

My approach would be to improve the catalog adapters. Even if you stick 
to the behavior implemented in setuphandlers.py it would have been 
easier and more straight forward to implement it in a subclass of 
ZCatalogXMLAdapter, overriding the default adapter.

But fixing some general catalog adapter issues will make your special 
behavior obsolete:

- The adapters should compare the new settings with the existing ones 
and make sure indexes are only updated if they are actually changed. 
This is not implemented so far.

- The adapters should modify existing indexes if the profile contains 
new settings. This is not implemented for the 'extra' elements.

- Reindexing might be very expensive. That's the reason why GenericSetup 
does no reindexing, you have to do it manually. We need a better 
solution for that, maybe some bookkeeping which indexes need to be 
reindexed and a button in the setup tool that triggers reindexing.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list