[Zope-CMF] Re: Problem with Registering Local Utilities on reinstall of product

Balazs Ree ree at ree.hu
Mon Jun 16 13:31:35 EDT 2008


Hi Nathan,

On Mon, 16 Jun 2008 10:51:34 -0500, Nathan Van Gheem wrote:

> Although, from what I've found, this is not the problem.  By stepping
> through the code, I found in this context, the local utility no longer
> exists.  So at some point in the install reinstall process it is
> unregistered.
> 
> Looking deeper, I found that in the reinstall of a product the method
> _cascadeRemove() is called from
> Products.CMFQuickInstallerTool.InstalledProduct that unregisters all
> utilities.
> 

> I don't know how to go about fixing this problem since the
> infrastructure is not set up to handle this.  Realistically, if there is
> an uninstall of a component needed, I would think it could be handled in
> the Products.GenericSetup.components class.
> 
> Any ideas to help me get around this problem would be greatly
> appreciated.

Not a solution, but the simplest workaround we found is setting up these 
utilities independently from genericsetup (and quickinstaller). This way 
you need to manually run an extra script to set up these utilities, and 
as a result quickinstaller will not have a chance to destroy and recreate 
the utility on reinstall. (Since it only borks stuff that it has set up 
itself.)

Another gross hack that I've heard of (although I did not actually try it 
myself) is tinker with the __cmp__ method of the utility, which may 
convince quickinstaller to leave the utility intact. Maybe someone else 
will give more details about this.

As far as for a real solution: I think the magic of quickinstaller is 
plain wrong. It should not ever delete your utilities on reinstall, 
because they form part of the content that is silently and entirely gone 
this way. (Think about object relations that are stored in local 
utilities, to understand the weight of this disaster.) I go even one step 
further: it also should not delete the utilities in case of an uninstall 
either, instead it should let you decide to delete them manually. There 
is something about upgrades (migrating data from an old version of 
utility to a new version) that makes this case a bit more complicated, 
however this is a more advanced use case and does not justify the data 
loss that happens on every reinstall, with the current implementation.

Berst wishes,

-- 
Balazs Ree



More information about the Zope-CMF mailing list