Plone 6 Classic with Mosaic - No module named 'plone.app.layout.navigation.defaultpage'

I'm trying to use Mosaic in 2022 on Plone 6 classic but coming upon the following error

  File "/home/code/my.site/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/config.py", line 872, in finish
    args = toargs(context, *self.argdata)
  File "/home/code/my.site/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/config.py", line 1702, in toargs
    args[str(name)] = field.fromUnicode(s)
  File "/home/code/my.site/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/fields.py", line 173, in fromUnicode
    value = self.context.resolve(name)
  File "/home/code/my.site/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/config.py", line 225, in resolve
    __import__(mname)
  File "/home/code/my.site/eggs/plone.app.standardtiles-2.4.2-py3.9.egg/plone/app/standardtiles/navigation.py", line 5, in <module>
    from plone.app.layout.navigation.defaultpage import isDefaultPage
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/code/my.site/eggs/plone.app.standardtiles-2.4.2-py3.9.egg/plone/app/standardtiles/layout.zcml", line 8.4-17.10
    File "/home/code/my.site/parts/instance/etc/site.zcml", line 16.2-16.23
    File "/home/code/my.site/eggs/Products.CMFPlone-6.0.0b2-py3.9.egg/Products/CMFPlone/configure.zcml", line 118.2-122.8
    File "/home/code/my.site/eggs/plone.app.mosaic-2.2.5-py3.9.egg/plone/app/mosaic/configure.zcml", line 10.2-10.47
    File "/home/code/my.site/eggs/plone.app.standardtiles-2.4.2-py3.9.egg/plone/app/standardtiles/configure.zcml", line 35.4-35.34
    ModuleNotFoundError: No module named 'plone.app.layout.navigation.defaultpage'

I checked on plone.app.layout.navigation and definitely no longer includes defaultpage, but it seems the standardtiles still believe that it should be there.

For now I'm paring down the site to avoid depending on Mosaic and exploring creating views using just tiles where needed.

David, always check the issues :slight_smile: Plone6 broken, defaultpage moved to plone.base.defaultpage · Issue #135 · plone/plone.app.standardtiles · GitHub

Thanks @mtrebron
It's definitely an issue. Working around it for the moment. It either means

  1. fixing the imports in all the dependent packages
  2. fixing defaultpage back to how it worked
  3. dance around the issue by avoiding anything that is broken by this

#2 sounds like the simplest but I may be missing something.

Interesting... fixed in code here: plone.app.standardtiles/navigation.py at main · plone/plone.app.standardtiles · GitHub
but not in the zcml - this might be trivial to fix, rather than paring down the site

Actually, was fixed already: plone.app.standardtiles/CHANGES.rst at main · plone/plone.app.standardtiles · GitHub

Ah... so pin a newer version of plone.app.standardtiles it seems.

I think so, and ask @mauritsvanrees for a release of plone.app.standardtiles and inclusion in Plone 6b3

What's the protocol? Do I just say hey @mauritsvanrees please release a new version of plone.app.standardtiles in the next Plone 6 release...
??
Open an issue?

Either of those will work.

But the new version is already included in 6.0.0b2. Problem is that you have to include https://dist.plone.org/release/6.0.0b2/versions-ecosystem.cfg explicitly. It is not pulled in by versions.cfg anymore.

1 Like

Ah!... thanks @mauritsvanrees
@petschki gave me the heads on using the versions-ecosystem.cfg trying it out now.

Since my Dockerfile is based on a pip-based install. I created a requirements.txt file from the versions-ecosystem.cfg file.
This is what my Dockerfile looks like now:
I stuffed all the ecosystem and extras into a requirements.txt
(@mauritsvanrees a ecosystem-requirements.txt to complement the ecosystem.cfg file would be helpful, I think.)

FROM plone/plone-backend:6.0.0b2

COPY src/site.profile /app/src/site.profile
COPY src/plonetheme.fourteen /app/src/plonetheme.fourteen
COPY src/site.content /app/src/site.content
COPY src/site.plone /app/src/site.plone
COPY src/site.customviews /app/src/site.customviews
COPY src/requirements.txt /app/src/requirements.txt

RUN apt-get update \
    && apt-get install -y --no-install-recommends gcc \
    && rm -rf /var/lib/apt/lists/*

RUN /app/bin/pip install --editable /app/src/site.content \
 && /app/bin/pip install --editable /app/src/plonetheme.fourteen \
 && /app/bin/pip install --editable /app/src/site.profile \
 && /app/bin/pip install --editable /app/src/site.plone \
 && /app/bin/pip install --editable /app/src/site.customviews \
 && /app/bin/pip install -r /app/src/requirements.txt \
 && /app/bin/pip install "collective.exportimport==1.5" "collective.easyform==4.1.0" 

https://dist.plone.org/release/6.0.0b2/constraints.txt already contains the ecosystem.

Also, you may want too look at mxdev and read Install Plone backend from its Packages – Step by Step – Install — Plone Documentation v6.0-dev

@jensens I have a question...
What if I want to use a package on the filessystem as a custom source?

I get that, by convention, mxdev expects to find a requirements.txt and a constraints.txt and relies on a special .ini file to override the configuration with custom packages, the result is a single requirements-mxdev.txt with all needed packages.

The example in the docs shows adding a custom package from a git source....

pip install mxdev
mxdev -c mx.ini

pip install -r requirements-mxdev.txt

The example of an mx.ini file was this:

[settings]
# constraints of Plone packages
version-overrides =
    plone.api>=2.0.0a3

[plone.restapi]
url = git@github.com:plone/plone.restapi.git
branch = master
extras = test

What if my source files are on the filesystem (ie. not in a git repo),
can my url be the path to my source on my filesystem?
Something like this...

[my.package]
url = src/my.package
extras = test

Thanks @jensens

Read this, there are clues to solve question

@1letter so basically you append filesystem sources to your requirements.txt...

-e src/my.addon
-e src/my.addon[test]

:thinking: interesting... your example is mx.dev free but it certainly provides a direction.

you will install your local addon. this happens via pip. mx.dev is today only useable for checkout via vcs, e.g. git

Point 3 in Overview

Reasonable. I suppose I can live with that.

You have those in filesystem only? I usually put those in git repositories too.
If in FS only, it is enough to add -e src/my.package to the requirements.txt no additional magic needed.

I have a monolithic setup (all project code in one repo), on purpose (it fits the current use case).

I have a semi automated process which builds everything each time I commit my monolithic repo.
The customisations are stored in a src/ folder.
For this reason I'll be using the -e src/my.package approach.

1 Like