From 51c81c8e24019a1d9200a06449f2569e91320f57 Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Thu, 8 Oct 2026 10:25:46 +0200 Subject: [PATCH] create-site: install plone.app.caching when needed. Otherwise a fresh `make stack-start` gives an error in the `create-site` part, when it wants to set caching proxies: ``` KeyError: 'plone.cachepurging.interfaces.ICachePurgingSettings.enabled' ``` Alternatively, we could add `plone.app.caching` to the dependencies of the package, and adds its profile in `metadata.xml`, and make sure `testing.py` loads its zcml, but even then I got errors when running `make test`. --- scripts/create_site.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/create_site.py b/scripts/create_site.py index e9954f4..eb6d894 100644 --- a/scripts/create_site.py +++ b/scripts/create_site.py @@ -1,5 +1,6 @@ from AccessControl.SecurityManagement import newSecurityManager from collective.matomoaitracker.interfaces import IBrowserLayer +from plone.base.utils import get_installer from Products.CMFPlone.factory import _DEFAULT_PROFILE from Products.CMFPlone.factory import addPloneSite from Products.GenericSetup.tool import SetupTool @@ -100,6 +101,10 @@ def asbool(s): # Purge Varnish when content changes, see varnish/default.vcl. CACHING_PROXIES = os.getenv("CACHING_PROXIES") if CACHING_PROXIES: + installer = get_installer(site) + if not installer.is_product_installed("plone.app.caching"): + installer.install_product("plone.app.caching") + site.portal_setup.upgradeProfile("plone.app.caching:default") prefix = "plone.cachepurging.interfaces.ICachePurgingSettings" registry[f"{prefix}.enabled"] = True registry[f"{prefix}.cachingProxies"] = tuple(CACHING_PROXIES.split())