collective / uwosh.snippets

Adds dynamically-updated rich text snippets to Plone. Update a snippet to display the change everywhere the snippet is used (pages, news items, events, anywhere rich text and TinyMCE appear).
4 stars 3 forks source link

Both profiles install and uninstall shows up when creating a new site #6

Closed gforcada closed 10 years ago

gforcada commented 10 years ago

When creating a new Plone site, on the list of add-ons to install both install and uninstall profile show up.

I'm not sure how one can hide the uninstall one, but I guess there has to be a way to do so. Will grep for examples if time allows.

djowett commented 10 years ago

I'm not using snippets at the mo, so excuse me for not doing a pull request for this.

But try this in a setuphandlers.py

from Products.CMFPlone.interfaces import INonInstallable
from zope.interface import implements

class HiddenProfiles(object):
    implements(INonInstallable)

    def getNonInstallableProfiles(self):
        """
Prevents all profiles but 'default' from showing up in the
profile list when creating a Plone site.
"""
        return [
            u'snippets:uninstall',
        ]

With this added to configure.zcml

<!-- Hide the non default profiles -->
<utility
    factory=".setuphandlers.HiddenProfiles"
    name="snippets"
    provides="Products.CMFPlone.interfaces.INonInstallable" />

I got this from plone.app.contenttypes as I recall

obct537 commented 10 years ago

I tried this, and both profiles still show up. I can't figure out specifically what plone.app.contenttypes is doing differently to make it work.

enfold-josh commented 10 years ago

I believe that your getNonInstallableProfiles should return [u'uwosh.snippets:uninstall',]

djowett commented 10 years ago

Yes, that would make sense

obct537 commented 10 years ago

@enfold-josh @djowett That fixed it, thanks!