[Zope-CMF] GenericSetup: Apply profile dependencies only once

yuppie y.2015 at wcm-solutions.de
Fri Sep 25 10:31:58 CEST 2015


Hi Maurits,

Maurits van Rees wrote:
> Op 24-09-15 om 13:54 schreef yuppie:
>> if you run a base profile in purge mode, you usually want to undo all
>> previous configuration and start from scratch. In theory you could do
>> that just with some setup handlers and keep the rest of the
>> configuration. But I doubt someone uses it that way.
>>
>> If you start from scratch, old profile versions data becomes incorrect.
>> So I think GenericSetup should delete that data automatically.
> 
> I have updated my pull request to add that purgeProfileVersions method
> and to run this before running the import steps of a base profile.
> 
> See https://github.com/zopefoundation/Products.GenericSetup/pull/18

it looks a bit strange to have that new code inside the loop because
versions should only be purged once before applying the first profile in
the chain.

But I hope these assertions are true:

- a profile that depends on more than one base profile is broken anyway

- if there is a base profile in the chain, it is always the first in the
chain

So it might be ok to purge versions inside the loop. But I don't think
it makes sense to purge versions if we don't reapply the base profile in
purge mode. I would make the change after the BeforeProfileImportEvent.
In that place it should be possible to use the shouldPurge method
instead of checking the profile type. Or is anyone running extension
profiles in purge mode? In that case we have to check for both.

Looking at that code, I think a better approach (but also much bigger
change) would be to make the version handling an extra export/import
step for metadata.xml. That would allow to export/import complete
profiles (the merged result from base and extension profiles) without
loosing version information.

Cheers,

	Yuppie



More information about the Zope-CMF mailing list