plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
243 stars 186 forks source link

Fix problem when adding a Plone site with a custom INonInstallable ut… #3863

Closed thet closed 9 months ago

thet commented 10 months ago

…ility without a getNonInstallableProfiles method.

Fixes: #3862.

This PR targets CMFPlone 5.2.x

mister-roboto commented 10 months ago

@thet thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

thet commented 10 months ago

@jenkins-plone-org please run jobs

mauritsvanrees commented 9 months ago

I have a doubt about this. Technically if the utility doesn't have a getNonInstallableProfiles method, then it didn't properly implement the INonInstallable interface. If I am trying to add an INonInstallable utility and I make a typo in the method name, this change means that it will silently fail instead of giving a helpful error so that I notice the typo.

That is true. But in the add-ons control panel we already do the same: we check if getNonInstallableProfiles is there. Also, if you do make a typo in the method name, it is usually not so bad: you will get more profiles or products in a list, which probably confuses users, but the package should still work.

It is not clear in the interface, but I intended the two methods to be optional: it is fine to only give a list of profiles or only give a list of products, without needing to provide a dummy method for the other, or inheriting from a base class with dummy methods.

So: LGTM.