Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComponentLookupError while migrating Plone 4.3 into Plone 5.0 #1187

Closed
codeix opened this issue Oct 17, 2015 · 7 comments · Fixed by #1412
Closed

ComponentLookupError while migrating Plone 4.3 into Plone 5.0 #1187

codeix opened this issue Oct 17, 2015 · 7 comments · Fixed by #1412

Comments

@codeix
Copy link
Member

codeix commented Oct 17, 2015

We test the migration from plone 4.3 to plone 5.0. The database can be found here:
https://www.dropbox.com/s/v1ni5l4ajy6qnfo/43-langs-pam-dx.tar.gz?dl=0
Installation:

  • Plone 4.3.7
  • all content types are dexterity
  • Supports two languages: english and german

The plone 5.0 Migration step should make sure that both "Diazo theme support" and "Barceloneta Theme" are also run during the migration. If not you will get an error like:

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module Products.CMFPlone.controlpanel.browser.resourceregistry, line 186, in __call__
  Module Products.Five.browser.pagetemplatefile, line 125, in __call__
  Module Products.Five.browser.pagetemplatefile, line 59, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module five.pt.engine, line 93, in __call__
  Module z3c.pt.pagetemplate, line 163, in render
  Module chameleon.zpt.template, line 258, in render
  Module chameleon.template, line 191, in render
  Module chameleon.template, line 171, in render
  Module b1759f7231dc7c9a10caf15ae190d581.py, line 486, in render
  Module f28459d06873e32b18fadc6d7cd60dd4.py, line 282, in render_master
  Module 3f100205ad341e1d5f362b834dde840a.py, line 1227, in render_master
  Module f28459d06873e32b18fadc6d7cd60dd4.py, line 264, in __fill_content
  Module 3f100205ad341e1d5f362b834dde840a.py, line 458, in render_content
  Module f28459d06873e32b18fadc6d7cd60dd4.py, line 253, in __fill_main
  Module b1759f7231dc7c9a10caf15ae190d581.py, line 226, in __fill_prefs_configlet_main
  Module five.pt.expressions, line 161, in __call__
  Module Products.CMFPlone.controlpanel.browser.resourceregistry, line 428, in config
  Module Products.CMFPlone.controlpanel.browser.resourceregistry, line 372, in get_overrides
  Module Products.CMFPlone.controlpanel.browser.resourceregistry, line 78, in __init__
  Module zope.component._api, line 169, in getUtility
ComponentLookupError: (<InterfaceClass plone.resource.interfaces.IResourceDirectory>, 'persistent')

@naro
Copy link
Member

naro commented Nov 2, 2015

I'm getting the same error but slightly different traceback when migrated old Plone 3 site to 4.3.6 even without activating Diazo theme support yet. p.a.multilingual is installed as well.

Traceback (innermost last):

Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module plone.app.theming.browser.controlpanel, line 50, in __call__
Module plone.app.theming.browser.controlpanel, line 72, in update
Module plone.app.theming.browser.controlpanel, line 56, in _setup
Module plone.app.theming.utils, line 382, in getZODBThemes
Module plone.resource.manifest, line 220, in getZODBResources
Module zope.component._api, line 169, in getUtility
ComponentLookupError: (<InterfaceClass plone.resource.interfaces.IResourceDirectory>, 'persistent')

@pbauer
Copy link
Member

pbauer commented Nov 2, 2015

You need to install Diazo to get the site running in Plone 5. You can do this in portal_setup by importing the Diazo Theme Support Profile.

@pbauer pbauer closed this as completed Nov 2, 2015
@naro
Copy link
Member

naro commented Nov 2, 2015

In my case I don't want Diazo on this site. It is migrated Plone 4.3.6(7) site. It should work without Diazo, shouldn't it ?

@pbauer
Copy link
Member

pbauer commented Nov 2, 2015

No. You need to install diazo. You can disable the theme if you want but you need diazo.

@mauritsvanrees
Copy link
Member

Don't we need migration for this, installing the Diazo support always when migrating to Plone 5? I have created a clean Plone Site in coredev 4.3, copied the var directory to coredev 5.0, started it, migrated it, and got the above error when viewing the site.

Alternatively, this avoids the ComponentLookupError:

$ git diff
diff --git a/Products/CMFPlone/traversal.py b/Products/CMFPlone/traversal.py
index da58edc..87bd210 100644
--- a/Products/CMFPlone/traversal.py
+++ b/Products/CMFPlone/traversal.py
@@ -1,5 +1,5 @@
 from plone.resource.traversal import ResourceTraverser
-from zope.component import getUtility
+from zope.component import queryUtility
 from plone.resource.interfaces import IResourceDirectory
 from plone.resource.interfaces import IUniqueResourceRequest
 from Products.CMFPlone.interfaces.resources import (
@@ -27,9 +27,9 @@ class PloneBundlesTraverser(ResourceTraverser):
         if more_traversal:
             resource_filepath = resource_filepath.split('/')[-1]

-        persistentDirectory = getUtility(IResourceDirectory, name="persistent")
+        persistentDirectory = queryUtility(IResourceDirectory, name="persistent")
         directory = None
-        if OVERRIDE_RESOURCE_DIRECTORY_NAME in persistentDirectory:
+        if persistentDirectory is not None and OVERRIDE_RESOURCE_DIRECTORY_NAME in persistentDirectory:
             container = persistentDirectory[OVERRIDE_RESOURCE_DIRECTORY_NAME]
             if resource_name in container:
                 directory = container[resource_name]

@hvelarde hvelarde changed the title Migration plone 4.3 to plone 5.0 with plone.app.multilanguage ComponentLookupError while migrating Plone 4.3 into Plone 5.0 Feb 24, 2016
@hvelarde
Copy link
Member

same error over here while updating vanilla Plone 4.3.7 with one add-on installed into Plone 5.0.2.

2016-02-24 09:16:44 ERROR Zope.SiteErrorLog 1456316204.090.23818938378 http://localhost:8080/Plone/++plone++static
Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.BaseRequest, line 508, in traverse
  Module ZPublisher.BaseRequest, line 332, in traverseName
  Module zope.traversing.namespace, line 112, in namespaceLookup
  Module Products.CMFPlone.traversal, line 30, in traverse
  Module zope.component._api, line 169, in getUtility
ComponentLookupError: (<InterfaceClass plone.resource.interfaces.IResourceDirectory>, 'persistent')

@pbauer's workaround worked but is not evident and you have to change your site language to English or you are going to have a hard time trying to find the Diazo theme support option.

mauritsvanrees added a commit that referenced this issue Feb 25, 2016
…tory is not registered.

This can happen if Diazo is not installed.
We might want to install it when migrating to Plone 5,
but meanwhile this fixes the immediate error in Plone 5.

With the meta-bundles plip, added in Plone 5.0.3,
it would already fail during migration.

Fixes #1187
@mauritsvanrees
Copy link
Member

In coredev it already fails when doing the migration:

Traceback (most recent call last):
  File "/Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/MigrationTool.py", line 268, in upgrade
    step['step'].doStep(setup)
  File "/Users/maurits/community/plone-coredev/5.0/src/Products.GenericSetup/Products/GenericSetup/upgrade.py", line 166, in doStep
    self.handler(tool)
  File "/Users/maurits/shared-eggs/plone.app.upgrade-1.3.21-py2.7.egg/plone/app/upgrade/v50/alphas.py", line 34, in to50alpha3
    loadMigrationProfile(context, 'profile-plone.app.upgrade.v50:to50alpha3')
  File "/Users/maurits/shared-eggs/plone.app.upgrade-1.3.21-py2.7.egg/plone/app/upgrade/utils.py", line 134, in loadMigrationProfile
    context.runAllImportStepsFromProfile(profile, purge_old=False)
  File "/Users/maurits/community/plone-coredev/5.0/src/Products.GenericSetup/Products/GenericSetup/tool.py", line 379, in runAllImportStepsFromProfile
    dependency_strategy=dependency_strategy)
  File "/Users/maurits/community/plone-coredev/5.0/src/Products.GenericSetup/Products/GenericSetup/tool.py", line 1414, in _runImportStepsFromContext
    message = self._doRunImportStep(step, context)
  File "/Users/maurits/community/plone-coredev/5.0/src/Products.GenericSetup/Products/GenericSetup/tool.py", line 1226, in _doRunImportStep
    return handler(context)
  File "/Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/resources/exportimport/bundles.py", line 19, in combine
    combine_bundles(site)
  File "/Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/resources/browser/combine.py", line 84, in combine_bundles
    persistent_directory = getUtility(IResourceDirectory, name="persistent")
  File "/Users/maurits/shared-eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 169, in getUtility
    raise ComponentLookupError(interface, name)
ComponentLookupError: (<InterfaceClass plone.resource.interfaces.IResourceDirectory>, 'persistent')

We may want to install Diazo in plone.app.upgrade.

But for now, I have created a pull request in CMFPlone with the fix I already mentioned above.
Note that with the recent meta bundles plip, it already fails during migration, which makes it worse. The pull request fixes that too.

mister-roboto pushed a commit to plone/buildout.coredev that referenced this issue Feb 26, 2016
Branch: refs/heads/master
Date: 2016-02-25T22:43:34+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/Products.CMFPlone@66bf70a

Do not fail when viewing any page, when the persistent resource directory is not registered.

This can happen if Diazo is not installed.
We might want to install it when migrating to Plone 5,
but meanwhile this fixes the immediate error in Plone 5.

With the meta-bundles plip, added in Plone 5.0.3,
it would already fail during migration.

Fixes plone/Products.CMFPlone#1187

Files changed:
M CHANGES.rst
M Products/CMFPlone/resources/browser/combine.py
M Products/CMFPlone/resources/browser/scripts.py
M Products/CMFPlone/resources/browser/styles.py
M Products/CMFPlone/traversal.py
Repository: Products.CMFPlone
Branch: refs/heads/master
Date: 2016-02-26T09:23:47+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/Products.CMFPlone@0d5172a

Merge pull request #1412 from plone/issue-1187

Do not fail when viewing any page, when the persistent resource directory is not registered.

Files changed:
M CHANGES.rst
M Products/CMFPlone/resources/browser/combine.py
M Products/CMFPlone/resources/browser/scripts.py
M Products/CMFPlone/resources/browser/styles.py
M Products/CMFPlone/traversal.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants