From bfcf3fa61813cd97f89920a7daca7c8e0b2cd1f2 Mon Sep 17 00:00:00 2001 From: ale-rt Date: Thu, 15 Sep 2022 22:21:00 +0200 Subject: [PATCH 1/2] Deprecate the portal_properties tool The tool gets most of the methods from OFS.PropertyManager. The most relevant are using internally the hasProperty method. Deprecating this should be enough to finally start removing this obsolete tool and a bunch of code that depends on that. Refs. #125 --- Products/CMFPlone/PropertiesTool.py | 18 ++++++++++++++++++ news/125.bugfix | 1 + 2 files changed, 19 insertions(+) create mode 100644 news/125.bugfix diff --git a/Products/CMFPlone/PropertiesTool.py b/Products/CMFPlone/PropertiesTool.py index d8ce537a1d..2fde5d0c32 100644 --- a/Products/CMFPlone/PropertiesTool.py +++ b/Products/CMFPlone/PropertiesTool.py @@ -19,6 +19,7 @@ from zope.component import getUtility from zope.component import queryUtility from Products.CMFCore.interfaces import ISiteRoot +from zope.deprecation import deprecate @implementer(IPropertiesTool) @@ -106,6 +107,15 @@ def title(self): def smtp_server(self): return getUtility(IMailHost).smtp_host + + @deprecate( + "The portal portal_properties tool will be removed. " + "Use the portal_registry instead." + ) + def hasProperty(self, id): + return super().hasProperty(id) + + InitializeClass(PropertiesTool) @@ -125,4 +135,12 @@ def __init__(self, id, title=''): manage_options = (PropertyManager.manage_options + SimpleItem.manage_options) + @deprecate( + "The portal portal_properties tool will be removed. " + "Use the portal_registry instead." + ) + def hasProperty(self, id): + return super().hasProperty(id) + + InitializeClass(SimpleItemWithProperties) diff --git a/news/125.bugfix b/news/125.bugfix new file mode 100644 index 0000000000..951a089444 --- /dev/null +++ b/news/125.bugfix @@ -0,0 +1 @@ +Deprecate the portal_properties tool From 938e814b861eb8b3808e0d841f81480d5b15d49b Mon Sep 17 00:00:00 2001 From: ale-rt Date: Mon, 19 Sep 2022 09:09:02 +0200 Subject: [PATCH 2/2] Update deprecation messages --- Products/CMFPlone/PropertiesTool.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Products/CMFPlone/PropertiesTool.py b/Products/CMFPlone/PropertiesTool.py index dc2116a3f3..f0ea227709 100644 --- a/Products/CMFPlone/PropertiesTool.py +++ b/Products/CMFPlone/PropertiesTool.py @@ -108,8 +108,10 @@ def smtp_server(self): @deprecate( - "The portal portal_properties tool will be removed. " - "Use the portal_registry instead." + "The portal portal_properties tool will be removed in Plone 6.1. " + "Use the portal_registry instead. " + "Check https://github.com/plone/Products.CMFPlone/issues/125 " + "for more details." ) def hasProperty(self, id): return super().hasProperty(id) @@ -135,8 +137,10 @@ def __init__(self, id, title=''): + SimpleItem.manage_options) @deprecate( - "The portal portal_properties tool will be removed. " - "Use the portal_registry instead." + "The portal portal_properties tool will be removed in Plone 6.1. " + "Use the portal_registry instead. " + "Check https://github.com/plone/Products.CMFPlone/issues/125 " + "for more details." ) def hasProperty(self, id): return super().hasProperty(id)