6.1: Cleanup plone.app.discussion settings when package is missing #330
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the site contains comments, we throw an error and stop the upgrade. The advice then is to add the
plone.app.discussion
package.This is part of plone/Products.CMFPlone#3958
I tried offering to remove existing comments, when the user has explicitly set an environment variable. But this gets tricky. In the catalog you can search for Discussion Items, but when you do
brain.getObject()
this fails with an AttributeError because the path contains++conversation++default
and this is only defined whenplone.app.discussion
is available. We could get all brains, check if they havetotal_comments
more than zero, get the object, and thendel __annotations__["plone.app.discussion"]
. But then we would need to unindex the actual comments as well, so it starts sounding hairy. Let someone implement this who actually needs it. That would be the case for a site where there were comments in 6.0, but in 6.1 they no longer want the comments. But that really is a corner case.What I did to test this PR:
bin/buildout -c plips/plip-padiscussion-addon.cfg
. Dogit pull
first, I have updated the plip file.bin/instance-cmfplone fg
. This starts the 6.1 site with Products.CMFPlone (so withoutplone.app.discussion
), but withplone.app.upgrade
andplone.app.caching
as extras, so you can test the upgrade.@@plone-upgrade
of the first Plone Site should work fine and cleanup everything.plone.app.discussion
to the packages. You see this advice in the browser:In fact, when upgrading from Plone 5.2 on a site that has comments, you already get into a traceback before you reach the new upgrade step:
I also tried first migrating the 5.2 site to 6.0. Then the above traceback does not happen.
Also the
PicklingError
from this comment only happens when you migrate from 5.2 directly to 6.1. On a site that is first migrated to 6.0 it goes better.