A little Plone 4.0py2 -> 5.2py3 migration story

We've just migrated a big old Plone 4.0.10 Site with custom Archetypes types to Plone 5.2.1 python3 dexterity only. First I want to give a big shout out to @pbauer and his collective.migrationhelpers which saved our "Popo's" quite a lot ... so after everything was done and shining, we tried to install plone.app.mosaic but got a strange traceback:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 156, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 338, in publish_module
  Module ZPublisher.WSGIPublisher, line 256, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 62, in call_object
  Module Products.CMFPlone.controlpanel.browser.quickinstaller, line 689, in __call__
  Module Products.CMFPlone.controlpanel.browser.quickinstaller, line 454, in install_product
  Module Products.GenericSetup.tool, line 393, in runAllImportStepsFromProfile
   - __traceback_info__: profile-plone.app.mosaic:default
  Module Products.GenericSetup.tool, line 1465, in _runImportStepsFromContext
  Module Products.GenericSetup.tool, line 1277, in _doRunImportStep
   - __traceback_info__: toolset
  Module Products.GenericSetup.tool, line 146, in importToolset
  Module OFS.ObjectManager, line 384, in _setObject
  Module zope.event, line 32, in notify
  Module zope.component.event, line 27, in dispatch
  Module zope.component._api, line 124, in subscribers
  Module zope.interface.registry, line 442, in subscribers
  Module zope.interface.adapter, line 607, in subscribers
  Module plone.app.contentrules.handlers, line 175, in added
  Module plone.app.contentrules.handlers, line 154, in is_portal_factory
AttributeError: 'RequestContainer' object has no attribute 'isTemporary'

WTF?

First we've put a pdb into plone.app.contentrules to see what's happening ... portal_factory smells like there are some Archetypes bits left but we've cleaned everything and are running on DX-py3 only.

So going further down the rabbithole there was the dependency package plone.app.drafts with the portal_drafts tool defined in the default profile toolset.xml.
Now it gets interesting because it turned out, that the ToolsetRegistry of GenericSetup still held all the old portal_xxx tool IDs from archetypes and the addon products installed back in the Plone 4.0 Version in it's _required list ... and those are re-installed if they're missing (see https://github.com/zopefoundation/Products.GenericSetup/blob/master/Products/GenericSetup/registry.py#L647).

fun fact: the base class of those re-installed Archetypes tools is plone.app.upgrade.atcontentypes_bbb.FactoryTool

Solution:
I've grep'ed a bit through my buildout omelette and found a nice piece of code in plone.app.upgrade.v40.alphas from hannosch back in 2009 which I ran in an upgrade step of our migration addon and after that the installation above worked again.
Details here: https://github.com/plone/plone.app.upgrade/blob/master/plone/app/upgrade/v40/alphas.py#L382

Let's move on to the next Plone 4.0 migration and see what happens there :wink:

3 Likes

Plone Foundation Code of Conduct