We have a project called brasil.gov.portal that is mainly a policy adding a bunch of dependencies and a specific theme. Right now we're into creating a new release, 1.1.4, and some installations are using an old version, 1.0.5. All releases are using upgradeSteps between them.
For this 1.1.4 release, we're planning to remove plone.app.collection 2.0b5 pinning (since it's not needed after plone.app.contenttypes 1.0) but we now have a problem: this plone.app.collection version registered plone.app.collection.interfaces.IPloneAppCollectionLayer as a browserlayer, so if we remove the pinning, run buildout and try to run our upgradeSteps, at the end of the first one from 1.0.5 to 1.1.4, we get:
2016-06-14 15:51:25 ERROR Zope.SiteErrorLog 1465930285.170.776153375467 http://localhost:8080/Plone/portal_setup/manage_doUpgrades Traceback (innermost last): Module ZPublisher.Publish, line 146, in publish Module Zope2.App.startup, line 301, in commit Module transaction._manager, line 89, in commit Module transaction._transaction, line 329, in commit Module transaction._transaction, line 443, in _commitResources Module ZODB.Connection, line 567, in commit Module ZODB.Connection, line 623, in _commit Module ZODB.Connection, line 658, in _store_objects Module ZODB.serialize, line 422, in serialize Module ZODB.serialize, line 431, in _dump PicklingError: Can't pickle <class 'plone.app.collection.interfaces.IPloneAppCollectionLayer'>: import of module plone.app.collection.interfaces failed
We know this can be solved by:
- Adding 2.0b5 branch again to the instance buildout;
- Uninstall plone.app.collection (in our policy we would need to create an "uninstall" script and use "bin/instance run script.py" since a lot of products and profiles are hidden);
- Run the upgradeSteps;
- Remove 2.0b5 branch from buildout.
...but we have dozens of sites using brasil.gov.portal and doing this manual process is really cumbersome, specially for users that aren't into ZODB and Plone internals and are just trying to upgrade a policy product from http://localhost:8080/Plone/prefs_install_products_form. An upgradeStep needs to be run ASAP after buildout because there's a new record in registry from collective.cover that, if not run, breaks the frontpage.
Is there a way to solve this programatically (adding a mock, a fake class, something, we don't mind having this fake class if it means less pain for integrators and users) or are we stuck into adding a note to our README between upgrades about this manual solution? We know the correct way is the manual one to avoid crap in ZODB, but sometimes we need to be pragmatic. Should we just copy some snippets from https://github.com/collective/wildcard.fixmissing and adapt to our use case? What do you think?