Closed mauritsvanrees closed 2 months ago
And if, like me, you are wondering how this actually works with Buildout, this is the pretty print of Products.__path__
in that case (Plone 6.1):
['/Users/maurits/community/plone-coredev/6.1/src/Products.CMFPlone/Products',
'/Users/maurits/shared-eggs/cp312/Products.isurlinportal-3.0.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.PortalTransforms-4.1.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Zope-5.10-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.CMFPlacefulWorkflow-3.0.4-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.statusmessages-5.0.6-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.SiteErrorLog-6.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.PlonePAS-8.0.4-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.MimetypesRegistry-3.0.1-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.ExtendedPathIndex-4.0.1-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.DCWorkflow-3.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.CMFEditions-4.0.3-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.GenericSetup-3.0.2-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.CMFCore-3.5-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.ZCatalog-7.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.CMFDynamicViewFTI-7.0.2-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.PluggableAuthService-3.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.BTreeFolder2-5.1-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.PythonScripts-5.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.ExternalMethod-5.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.ZopeVersionControl-4.1-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.CMFUid-4.2-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.CMFDiffTool-4.0.4-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.MailHost-5.2-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.StandardCacheManagers-5.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.DateRecurringIndex-3.0.1-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.Sessions-5.0-py3.12.egg/Products',
'/Users/maurits/shared-eggs/cp312/Products.PluginRegistry-2.0-py3.12.egg/Products']
So there the Products path is not one directory, but multiple.
Meanwhile I have PRs ready for Plone 6.0 and 6.1.
Super explanation on the Products initialization phase!
You can try this out with https://github.com/plone/buildout.coredev/pull/945. Checkout the branch of that PR, run
make install
andmake zope-start
and try to create a Plone instance. This will fail withKeyError: 'Unicode Whitespace splitter'
because theinitialize
function is not called.So what is going on?
OFS.Application
installs products.get_products
.import Products
and then checks which Python packages are in the directory of that module..venv/lib/python3.12/site-packages/Products
.install_product
gets called, which results in calling theinitialize
function in__init__.py
if it exists.Products.CMFPlone
normally,CMFPlone
will be in that directory, so all is well.pip install -e src/Products.CMFPlone
), it will not be in this list. So theinitialize
function will not get called, and all kinds of stuff won't be registered. Creating a Plone Site or visiting an existing Plone site fails.five.registerPackage
.Products
namespace.So we should add
five:registerPackage
to theconfigure.zcml
ofProducts.CMFPlone
. Then it works. I will do that in 6.0 and 6.1.