The configlet that I have in controlpanel.xml is this one:
<object name="portal_controlpanel" meta_type="Plone Control Panel Tool" purge="False"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="sc.social.bookmarks">
<configlet title="Social Bookmarks" action_id="socialbookmarks"
appId="sc.social.bookmarks"
category="Products" condition_expr=""
icon_expr="string:${portal_url}/++resource++sb_logo/ico-social.gif"
url_expr="string:${portal_url}/@@bookmarks-providers"
visible="True"
i18n:attributes="title">
<permission>Manage portal</permission>
</configlet>
</object>
First, I created an uninstall profile with this inside the
import_steps.xml file:
<import-steps>
<import-step id="sc.social.bookmarks.uninstall"
version="20101115-01"
handler="sc.social.bookmarks.setuphandlers.uninstall"
title="Social Bookmarks uninstall.">
Social Bookmarks uninstall.
</import-step>
</import-steps>
Then I registered it in configure.xml:
<genericsetup:registerProfile
name="uninstall"
title="SC:Social Bookmarks uninstall"
directory="profiles/uninstall"
description="SC Social Bookmarks Profile"
provides="Products.GenericSetup.interfaces.EXTENSION"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
/>
After that, I created a setuphandlers.py:
def removeConfiglet(context):
configlet = 'socialbookmarks'
controlpanel = getToolByName(context, 'portal_controlpanel', None)
if controlpanel:
controlpanel.unregisterConfiglet(configlet)
def uninstall(context):
if context.readDataFile('sc.social.bookmarks_uninstall.txt') is None:
return
site = context.getSite()
removeConfiglet(site)
And finally I created an Extension/Install.py file with this inside:
def uninstall(portal):
setup_tool = getToolByName(portal, 'portal_setup')
setup_tool.runAllImportStepsFromProfile('profile-sc.social.bookmarks:uninstall')
setup_tool.setBaselineContext('profile-Products.CMFPlone:plone')
Everything looked fine so, to test it, I wrote this:
class UninstallTest(PloneTestCase):
layer = SocialBookmarksLayer
def uninstall(self):
setup = getToolByName(self.portal, 'portal_setup')
setup.runAllImportStepsFromProfile('profile-sc.social.bookmarks:uninstall')
def test_configlet_uninstall(self):
self.uninstall()
controlpanel = getattr(self.portal, 'portal_controlpanel')
installed = [a.getAction(self)['id'] for a in
controlpanel.listActions()]
self.failIf('socialbookmarks' in installed)
When I runt bin/test the test passes, but, when I install and uninstall
the package, the configlet is not removed.
Any hint?
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
