Removing a setup step from Plone 2.5
It's not always so easy to get a lingering generic setup step out of the master list in Plone 2.5 ... a product that doesn't clean up after itself can leave junk around that blocks you from adding new products.
In this case, a beta version of PloneFormGen left a step called "pleonformgen" hanging around that prevented me from installing products that ran generic setup, as it couldn't find that step. The solution was to run this script as an External method, with the relevant names switched out:
from Products.GenericSetup import profile_registry, EXTENSION
from Products.CMFPlone.interfaces import IPloneSiteRoot
from Products.CMFCore.utils import getToolByName
def remove_gen_setup(self):
setup = getToolByName(self, 'portal_setup')
#setup.setImportContext('profile-myproduct:default')
setup.setImportContext('PloneFormGen:default')
self.plone_log(' [*] Just say _something_')
ir = setup.getImportStepRegistry()
self.plone_log(ir.listSteps()) # for debugging and seeing what steps are available
# delete the offending step
try:
# del ir._registered['myproduct-badstep']
del ir._registered['pleonformgen']
except KeyError:
pass
# commit the changes to the zodb
import transaction
txn = transaction.get()
txn.commit()
The error message this took care of was:
------
2009-03-30T09:54:27 ERROR Zope.SiteErrorLog http://www.npowerseattle.org/portal_quickinstaller/installProducts
Traceback (innermost last):
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 333, in installProduct
- __traceback_info__: ('Paypal2SalesforceLead',)
Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
- __traceback_info__: ((<PloneSite at /npowerseattle_mp/npowerseattle_site>,), {}, None)
Module /var/db/zope/prod255/Products/Paypal2SalesforceLead/Extensions/Install.py, line 13, in install
Module Products.GenericSetup.tool, line 252, in runAllImportSteps
- __traceback_info__: profile-Products.Paypal2SalesforceLead:default
Module Products.GenericSetup.tool, line 766, in _runImportStepsFromContext
Module Products.GenericSetup.tool, line 727, in _doRunImportStep
- __traceback_info__: pleonformgen
Module Products.GenericSetup.registry, line 146, in getStep
Module Products.GenericSetup.utils, line 103, in _resolveDottedName
- __traceback_info__: Products.PloneFormGen.setuphandlers.importVarious
AttributeError: 'module' object has no attribute 'setuphandlers'
------
2009-03-30T09:54:27 CRITICAL txn.175884800 A storage error occurred during the second phase of the two-phase commit. Resources may be in an inconsistent state.
------
2009-03-30T09:54:27 ERROR Zope.SiteErrorLog http://www.npowerseattle.org/portal_quickinstaller/installProducts
Traceback (innermost last):
Module ZPublisher.Publish, line 121, in publish
Module Zope2.App.startup, line 240, in commit
Module transaction._manager, line 96, in commit
Module transaction._transaction, line 380, in commit
Module transaction._transaction, line 378, in commit
Module transaction._transaction, line 441, in _commitResources
Module ZODB.Connection, line 679, in tpc_finish
Module ZEO.ClientStorage, line 974, in tpc_finish
Module ZEO.ClientStorage, line 999, in _update_cache
Module ZEO.cache, line 367, in invalidate
AssertionError
