collective / collective.weather

A Plone package to display the current weather at selected locations inside a portlet or viewlet.
1 stars 1 forks source link

Uninstall error #44

Open jeanferri opened 8 years ago

jeanferri commented 8 years ago

I get an error when uninstalling collective.weather on Plone 4.3.6. Some idea? The traceback is:

Traceback (innermost last):

    Module ZPublisher.Publish, line 138, in publish
    Module ZPublisher.mapply, line 77, in mapply
    Module ZPublisher.Publish, line 48, in call_object
    Module <string>, line 4, in uninstallProducts
    Module AccessControl.requestmethod, line 70, in _curried
    Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 636, in uninstallProducts
    Module Products.CMFQuickInstallerTool.InstalledProduct, line 287, in uninstall
    Module Products.ExternalMethod.ExternalMethod, line 234, in __call__
    __traceback_info__: ((<PloneSite at /cm_sin/portal>,), {'reinstall': False}, (False,))
    Module /srv/plone/buildout-cache/eggs/collective.weather-1.0a4-py2.7.egg/collective/weather/Extensions/Install.py, line 17, in uninstall
    Module /srv/plone/buildout-cache/eggs/collective.weather-1.0a4-py2.7.egg/collective/weather/Extensions/Install.py, line 38, in remove_weather_portlets
    Module zope.component._api, line 109, in getMultiAdapter

ComponentLookupError: ((<plone.app.discussion.comment.Comment object at 0x7fc7fc26c398>, <plone.portlets.manager.PortletManager object at 0x7fc83c5a52a8>), <InterfaceClass plone.portlets.interfaces.IPortletAssignmentMapping>, u'') 
frapell commented 8 years ago

@jeanferri Looks like https://github.com/collective/collective.weather/blob/master/src/collective/weather/Extensions/Install.py#L21 gets all possible content from a catalog query. Comments are added to the catalog, but you cannot assign portlets to them. A fast fix would be to wrap line 38 of the Install.py file in a try - except in order to go on, or replace getMultiAdapter with queryMultiAdapter and check if you have a mapping.

A better fix would be to do a slightly better query to the catalog to just get content that can be adapted