From 2c39b01ca991bea94a8edc3a657e8e8719707b1b Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Tue, 8 Oct 2024 12:52:18 +0200 Subject: [PATCH] Fix Plone 5 related upgrade steps in Plone 6. --- CHANGES.rst | 3 +++ src/collective/easyform/upgrades/__init__.py | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 9f4fb92b..7389f0fc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,9 @@ Changelog 4.2.1 (unreleased) ------------------ +- Fix Plone 5 related upgrade steps in Plone 6. + [thet] + - Add plone.shortname behaviour to EasyForm type. [ThibautBorn] diff --git a/src/collective/easyform/upgrades/__init__.py b/src/collective/easyform/upgrades/__init__.py index b67b7ef1..8490ca18 100644 --- a/src/collective/easyform/upgrades/__init__.py +++ b/src/collective/easyform/upgrades/__init__.py @@ -1,3 +1,4 @@ +from importlib import import_module from plone import api import logging @@ -5,8 +6,18 @@ logger = logging.getLogger(__name__) +HAS_PLONE_6 = getattr( + import_module("Products.CMFPlone.factory"), "PLONE60MARKER", False +) + def update_last_compilation(context, timetuple=None): + if HAS_PLONE_6: + # No need to update the `last_compilation` time on Plone 6. + # The resources are refreshed with every restart of the instance + # automatically. + return + # Let's do the imports inline, so they are not needlessly done at startup. # Should not really matter, but oh well. from datetime import datetime