Solved: Migration from Plone3 to Plone5 fails include Blobmigration

My migration from Plone 2.5 to Plone 5 fails. I migrate to the latest Plone3 without errors. Then i copy the Data.fs to a Plone5 (coredev buildout via coredev-multipy) The migration of files and images to the blobstorage fails. if i run the plone-upgrade in Plone5-py2 instance-archetypes i get the following error:

Traceback (most recent call last):
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.contentmigration-2.2.1-py2.7.egg/Products/contentmigration/basemigrator/walker.py", line 194, in migrate
    migrator.migrate()
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.contentmigration-2.2.1-py2.7.egg/Products/contentmigration/basemigrator/migrator.py", line 215, in migrate
    self.createNew()
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.contentmigration-2.2.1-py2.7.egg/Products/contentmigration/archetypes.py", line 155, in createNew
    self.new_id, **self.schema)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.contentmigration-2.2.1-py2.7.egg/Products/contentmigration/common.py", line 69, in _createObjectByType
    ob = fti._constructInstance(container, id, *args, **kw)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.CMFCore-2.4.8-py2.7.egg/Products/CMFCore/TypesTool.py", line 553, in _constructInstance
    newid = m(id, *args, **kw)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/plone.app.blob-1.8.1-py2.7.egg/plone/app/blob/content.py", line 78, in addATBlobImage
    return addATBlob(container, id, subtype='Image', **kwargs)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/plone.app.blob-1.8.1-py2.7.egg/plone/app/blob/content.py", line 66, in addATBlob
    obj.manage_afterAdd(obj, container)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.Archetypes-1.16.2-py2.7.egg/Products/Archetypes/BaseContent.py", line 43, in manage_afterAdd
    BaseObject.manage_afterAdd(self, item, container)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.Archetypes-1.16.2-py2.7.egg/Products/Archetypes/BaseObject.py", line 161, in manage_afterAdd
    self.initializeLayers(item, container)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.Archetypes-1.16.2-py2.7.egg/Products/Archetypes/BaseObject.py", line 179, in initializeLayers
    self.Schema().initializeLayers(self, item, container)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.Archetypes-1.16.2-py2.7.egg/Products/Archetypes/Schema/__init__.py", line 351, in initializeLayers
    obj.initializeField(instance, field)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.Archetypes-1.16.2-py2.7.egg/Products/Archetypes/Storage/__init__.py", line 181, in initializeField
    self.set(field.getName(), instance, field.getDefault(instance))
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.Archetypes-1.16.2-py2.7.egg/Products/Archetypes/Field.py", line 682, in getDefault
    return method()
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/Products.Archetypes-1.16.2-py2.7.egg/Products/Archetypes/ExtensibleMetadata.py", line 221, in defaultLanguage
    return tool.getDefaultLanguage()
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/plone.i18n-4.0.6-py2.7.egg/plone/i18n/utility.py", line 176, in getDefaultLanguage
    return self.settings.default_language
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/plone.i18n-4.0.6-py2.7.egg/plone/i18n/utility.py", line 89, in settings
    registry = getUtility(IRegistry)
  File "/opt/upgrade-to-plone5/Plone5/py2/eggs/zope.component-4.6.1-py2.7.egg/zope/component/_api.py", line 154, in getUtility
    raise ComponentLookupError(interface, name)
ComponentLookupError: (<InterfaceClass plone.registry.interfaces.IRegistry>, '')

Should i patch plone.i18n with a hardcoded language value? That is the only idea that i have.

I think you should migrate the Plone 3 database to Plone 4.3.x before moving it to 5.2.

Yes, thats my next option. but it takes a lot of time. 25GB of Files and Images, the blobmigration started and it takes 4 hours with a small response from the system, and then, surprise, an error happens or all is fine. a little bit like lotto.

Now i'm migrate to 4.3.19 with blobmigration. All is fine. I copy filestorage and blbostorage to plone5py2 Installation. I get this traceback if i call the browserview 127.0.0.1/mysit/plone-upgrade:

Traceback (most recent call last):
  File "/opt/mig-to-plone5/Plone5/py2/eggs/waitress-1.4.4-py2.7.egg/waitress/channel.py", line 350, in service
    task.service()
  File "/opt/mig-to-plone5/Plone5/py2/eggs/waitress-1.4.4-py2.7.egg/waitress/task.py", line 171, in service
    self.execute()
  File "/opt/mig-to-plone5/Plone5/py2/eggs/waitress-1.4.4-py2.7.egg/waitress/task.py", line 441, in execute
    app_iter = self.channel.server.application(environ, start_response)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Paste-3.4.1-py2.7.egg/paste/translogger.py", line 69, in __call__
    return self.application(environ, replacement_start_response)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Zope-4.5-py2.7.egg/ZPublisher/httpexceptions.py", line 30, in __call__
    return self.application(environ, start_response)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Zope-4.5-py2.7.egg/ZPublisher/WSGIPublisher.py", line 364, in publish_module
    environ['REMOTE_USER'] = user.getUserName()
  File "/home/jan_buruck/.pyenv/versions/2.7.17/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Zope-4.5-py2.7.egg/ZPublisher/WSGIPublisher.py", line 214, in transaction_pubevents
    notify(pubevents.PubBeforeAbort(request, exc_info, retry))
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.event-4.4-py2.7.egg/zope/event/__init__.py", line 32, in notify
    subscriber(event)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.component-4.6.1-py2.7.egg/zope/component/event.py", line 27, in dispatch
    component_subscribers(event, None)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.component-4.6.1-py2.7.egg/zope/component/_api.py", line 124, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.interface-5.0.2-py2.7-linux-x86_64.egg/zope/interface/registry.py", line 448, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.interface-5.0.2-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 619, in subscribers
    subscription(*objects)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/plone.transformchain-2.0.2-py2.7.egg/plone/transformchain/zpublisher.py", line 121, in applyTransformOnFailure
    applyTransformOnSuccess(event)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/plone.transformchain-2.0.2-py2.7.egg/plone/transformchain/zpublisher.py", line 86, in applyTransformOnSuccess
    transformed = applyTransform(event.request)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/plone.transformchain-2.0.2-py2.7.egg/plone/transformchain/zpublisher.py", line 61, in applyTransform
    transformer = queryUtility(ITransformer)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.component-4.6.1-py2.7.egg/zope/component/_api.py", line 157, in queryUtility
    return getSiteManager(context).queryUtility(interface, name, default)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.interface-5.0.2-py2.7-linux-x86_64.egg/zope/interface/registry.py", line 287, in queryUtility
    return self.utilities.lookup((), provided, name, default)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/ZODB-5.6.0-py2.7.egg/ZODB/Connection.py", line 795, in setstate
    self._reader.setGhostState(obj, p)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/ZODB-5.6.0-py2.7.egg/ZODB/serialize.py", line 634, in setGhostState
    obj.__setstate__(state)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.component-4.6.1-py2.7.egg/zope/component/persistentregistry.py", line 41, in __setstate__
    self._createLookup()
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.interface-5.0.2-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 118, in _createLookup
    self._v_lookup = self.LookupClass(self)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.interface-5.0.2-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 470, in __init__
    self.init_extendors()
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.interface-5.0.2-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 507, in init_extendors
    self.add_extendor(p)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/zope.interface-5.0.2-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 511, in add_extendor
    for i in provided.__iro__:
AttributeError: type object 'IKSSRegistry' has no attribute '__iro__'

Ok i add Products.ResourceRegistries to my buildout, and now i can run the upgrade. i do this in the dry run mode. Next traceback:

.....
2020-07-11 20:52:45,311 INFO    [plone.app.upgrade:57][waitress-2] Removing unused interface indexes from relations catalog.
2020-07-11 20:52:45,314 INFO    [Products.GenericSetup.tool:1387][waitress-2] Importing profile profile-plone.staticresources:default with dependency strategy upgrade.
2020-07-11 20:52:45,315 INFO    [Products.GenericSetup.tool:1168][waitress-2] No upgrades available for profile profile-plone.resource:default. Profile stays at version (u'1',).
2020-07-11 20:52:45,315 INFO    [Products.GenericSetup.tool:1426][waitress-2] Applying main profile profile-plone.staticresources:default
2020-07-11 20:52:45,316 ERROR   [plone.app.upgrade:299][waitress-2] Upgrade aborted. Error:
Traceback (most recent call last):
  File "/opt/mig-to-plone5/Plone5/src/Products.CMFPlone/Products/CMFPlone/MigrationTool.py", line 292, in upgrade
    step['step'].doStep(setup)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/upgrade.py", line 168, in doStep
    self.handler(tool)
  File "/opt/mig-to-plone5/Plone5/src/plone.app.upgrade/plone/app/upgrade/v52/betas.py", line 142, in to52beta1
    qi.install_product('plone.staticresources')
  File "/opt/mig-to-plone5/Plone5/src/Products.CMFPlone/Products/CMFPlone/controlpanel/browser/quickinstaller.py", line 454, in install_product
    self.ps.runAllImportStepsFromProfile('profile-%s' % profile_id)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/tool.py", line 396, in runAllImportStepsFromProfile
    dependency_strategy=dependency_strategy)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/tool.py", line 1451, in _runImportStepsFromContext
    steps = self.getSortedImportSteps()
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/tool.py", line 280, in getSortedImportSteps
    step_infos = [self.getImportStepMetadata(step) for step in steps]
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/tool.py", line 286, in getImportStepMetadata
    res = self._import_registry.getStepMetadata(step, self)
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/registry.py", line 289, in getStepMetadata
    result['invalid'] = _resolveDottedName(result['handler']) is None
  File "/opt/mig-to-plone5/Plone5/py2/eggs/Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/utils.py", line 109, in _resolveDottedName
    module = __import__('.'.join(parts_copy))
  File "/opt/mig-to-plone5/Plone5/src/Products.ResourceRegistries/Products/ResourceRegistries/__init__.py", line 2, in <module>
    from Products.ResourceRegistries import config
ImportError: cannot import name config
2020-07-11 20:52:45,419 INFO    [plone.app.upgrade:308][waitress-2] End of upgrade path, main migration has finished.
2020-07-11 20:52:45,425 ERROR   [plone.app.upgrade:311][waitress-2] The upgrade path did NOT reach current version.
2020-07-11 20:52:45,425 ERROR   [plone.app.upgrade:312][waitress-2] Migration has failed
2020-07-11 20:52:45,425 INFO    [plone.app.upgrade:355][waitress-2] Dry run selected, transaction aborted

The file config.py exists in the package. Hmm. I'm going to debug Products.GenericSetup-2.0.2-py2.7.egg/Products/GenericSetup/utils.py

Now i'am debug Products.GenericSetup.registry.py:

def getStepMetadata(self, key, default=None):
         """ Return a mapping of metadata for the step identified by 'key'.
         o Return 'default' if no such step is registered.
         o The 'handler' metadata is available via 'getStep'.
         """
         info = self._registered.get(key)
         if info is None:
             return default
         result = info.copy()
         h = result['handler']
         try:
             testcheck = _resolveDottedName(h)
         except:
             import pdb
             pdb.set_trace()
             pass
         result['invalid'] = _resolveDottedName(result['handler']) is None
         return result

in the result['handler'] exists this:

{'dependencies': (u'toolset', u'componentregistry'),
 'description': u'\n  \n  \n    Import KSS registry\n ',
 'handler': 'Products.ResourceRegistries.exportimport.kssregistry.importKSSRegistry',
 'id': u'kssregistry',
 'title': u'KSS registry',
 'version': u'20070407-01'}

but this could not resolved. What should i do? Should i clear the componentregistry in an older plone version?

In a debug prompt i do the call for a test:

(Pdb++) module = __import__('.'.join(['Products', 'ResourceRegistries', 'exportimport', 'kssregistry', 'importKSSRegistry']))
*** ImportError: cannot import name config

The config is not imported in importKSSRegistry.py

ok, i solved the problem and the migration run.

in Products.ResourceRegistries.init.py i changed the import statement to:

# old: from Products.ResourceRegistries import config
from Products.ResourceRegistries.config import PROJECTNAME
1 Like