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

Hanno Schlichting plone at hannosch.info
Mon Jun 16 13:17:25 EDT 2008


Hi.

There's two issues here. One is with quick installer and one is with 
GenericSetup. This mailing list is not the right place to discuss issues 
with the first, please do that on the Plone developers mailing list.

Nathan Van Gheem wrote:
> Martin Aspeli pointed out,
> 
> I think the problem is in Products.GenericSetup.components - in _initUtilities it does
> 
>   elif factory is not None:
>       self.context.registerUtility(factory(), provided, name)
> 
> without first checking of a utility with this name for this interface already exists.

The code here does seem indeed to be wrong. There's two modes for GS 
import handlers, one being with purge and one without. The code in 
question does not support that correctly. It does work in some cases, as 
the underlying registerUtility function first checks if the component 
was already registered. It does so effectively by checking the newly 
registered object and the one that is already registered for equality. 
This check obviously fails in case of creating a new utility via a factory.

There is a bug report for this already at: 
https://bugs.launchpad.net/bugs/240170

> 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. 

GenericSetup doesn't have any uninstall support, so this is not the 
right place to handle this.

Your main issue here is with quick installer.

Hanno



More information about the Zope-CMF mailing list