Tuesday, December 20, 2011

Hiding uninstall profiles using Grok

Tired of seeing your uninstall profile listed even when your package has not being installed yet?

If you have five.grok among the dependencies of your package in setup.py, you can put the following code in a setuphandlers.py file:

from five import grok

from Products.CMFPlone.interfaces import INonInstallable

class HiddenProfiles(grok.GlobalUtility):


    def getNonInstallableProfiles(self):
        profiles = ['your.package:uninstall']
        return profiles

Remember that you need to Grok your package using the following line in your configure.zcml:

<grok:grok package="." />

This cool tip has been brought to you by Érico Andrei; enjoy it!