Hello,

    It seems that there is an issue with registering local utilities on a
Product install.  It seems that on a product reinstall, the local utility is
re-registered.  In doing so, you lose all data that the local utility was
managing.

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.


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.

> if 'utilities' in cascade:
>             utilities = getattr(self, 'utilities', [])
>             if utilities:
>                 sm = getSiteManager()
>                 for registration in utilities:
>                     provided = _resolveDottedName(registration[0])
>                     name = registration[1]
>                     if queryUtility(provided, name=name) is not None:
>                         sm.unregisterUtility(provided=provided, name=name)


The stack trace is like so,

>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/ZServer/PubCore/ZServerPublisher.py(25)__init__()
> -> response=b)
>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/ZPublisher/Publish.py(401)publish_module()
> -> environ, debug, request, response)
>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/ZPublisher/Publish.py(202)publish_module_standard()
> -> response = publish(request, module_name, after_list, debug=debug)
>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/ZPublisher/Publish.py(119)publish()
> -> request, bind=1)
>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/ZPublisher/mapply.py(88)mapply()
> -> if debug is not None: return debug(object,args,context)
>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/ZPublisher/Publish.py(42)call_object()
> -> result=apply(object,args) # Type s<cr> to step into published object.
>   <string>(6)_facade()
>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/AccessControl/requestmethod.py(64)_curried()
> -> return callable(*args, **kw)
>
> /Applications/Plone-3.1.1/myproject/parts/plone/CMFQuickInstallerTool/QuickInstallerTool.py(639)reinstallProducts()
> -> self.uninstallProducts(products, cascade, reinstall=True)
>   <string>(4)_facade()
>
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/AccessControl/requestmethod.py(64)_curried()
> -> return callable(*args, **kw)
>
> /Applications/Plone-3.1.1/myproject/parts/plone/CMFQuickInstallerTool/QuickInstallerTool.py(621)uninstallProducts()
> -> prod.uninstall(cascade=cascade, reinstall=reinstall)
>
> /Applications/Plone-3.1.1/myproject/parts/plone/CMFQuickInstallerTool/InstalledProduct.py(297)uninstall()
> -> self._cascadeRemove(cascade)
>
> /Applications/Plone-3.1.1/myproject/parts/plone/CMFQuickInstallerTool/InstalledProduct.py(386)_cascadeRemove()
> -> sm.unregisterUtility(provided=provided, name=name)
> >
> /Applications/Plone-3.1.1/myproject/parts/zope2/lib/python/zope/component/registry.py(102)unregisterUtility()
>

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.


Thanks,
Nathan Van Gheem
_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to