From 9e090d3f67bb6bebc5c354b0e766920474343cf8 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Thu, 28 Mar 2024 15:02:32 +0100 Subject: [PATCH 1/4] change cookie plugin: collective.volto.cookieconsent => collective.volto.gdprcookie --- CHANGES.rst | 5 ++++- setup.py | 3 ++- src/redturtle/volto/profiles/default/metadata.xml | 4 ++-- src/redturtle/volto/upgrades.py | 9 +++++++++ src/redturtle/volto/upgrades.zcml | 8 ++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 901da6e..9ffb81f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,10 @@ Changelog [cekk] - Add flag in controlpanel to enable/disable INameChooser customization. [cekk] - +- Uninstall collective.volto.cookieconsent (deprecated). Will be removed from dependencies in next releases. + [cekk] +- Add dependency to collective.volto.gdprcookie and install it by default. + [cekk] 5.4.8 (2024-03-19) ------------------ diff --git a/setup.py b/setup.py index b2c6853..505eaa2 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,8 @@ python_requires=">=3.7", install_requires=[ "setuptools", - "collective.volto.cookieconsent", + "collective.volto.cookieconsent", # this will be uninstalled and removed soon. + "collective.volto.gdprcookie", "collective.monkeypatcher", "collective.purgebyid", "kitconcept.seo>=2.0.0", diff --git a/src/redturtle/volto/profiles/default/metadata.xml b/src/redturtle/volto/profiles/default/metadata.xml index 62f5e34..a10e361 100644 --- a/src/redturtle/volto/profiles/default/metadata.xml +++ b/src/redturtle/volto/profiles/default/metadata.xml @@ -1,10 +1,10 @@ - 4304 + 4305 profile-plone.volto:default profile-plone.app.caching:with-caching-proxy - profile-collective.volto.cookieconsent:default + profile-collective.volto.gdprcookie:default profile-kitconcept.seo:default diff --git a/src/redturtle/volto/upgrades.py b/src/redturtle/volto/upgrades.py index ff45e9d..73fa809 100644 --- a/src/redturtle/volto/upgrades.py +++ b/src/redturtle/volto/upgrades.py @@ -8,6 +8,7 @@ from redturtle.volto.setuphandlers import remove_custom_googlebot from uuid import uuid4 from zope.schema import getFields +from plone.base.utils import get_installer import json import logging @@ -494,3 +495,11 @@ def to_4303(context): for brain in brains: event = brain.getObject() event.reindexObject(idxs=["start", "end"]) + + +def to_4305(context): + portal = api.portal.get() + installer = get_installer(portal, portal.REQUEST) + installer.uninstall_product(product_id="collective.volto.cookieconsent") + if not installer.is_product_installed("collective.volto.gdprcookie"): + installer.install_(product_id="collective.volto.gdprcookie") diff --git a/src/redturtle/volto/upgrades.zcml b/src/redturtle/volto/upgrades.zcml index 8b574da..1014d94 100644 --- a/src/redturtle/volto/upgrades.zcml +++ b/src/redturtle/volto/upgrades.zcml @@ -224,4 +224,12 @@ destination="4304" handler=".upgrades.update_registry" /> + From c30afc74dd7fdf69269a5cb72c9cbe7aef121f21 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Thu, 28 Mar 2024 15:04:22 +0100 Subject: [PATCH 2/4] code cleanup --- src/redturtle/volto/upgrades.py | 2 +- src/redturtle/volto/upgrades.zcml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/redturtle/volto/upgrades.py b/src/redturtle/volto/upgrades.py index 73fa809..8c091fa 100644 --- a/src/redturtle/volto/upgrades.py +++ b/src/redturtle/volto/upgrades.py @@ -3,12 +3,12 @@ from copy import deepcopy from plone import api from plone.app.upgrade.utils import installOrReinstallProduct +from plone.base.utils import get_installer from plone.dexterity.utils import iterSchemata from plone.restapi.behaviors import IBlocks from redturtle.volto.setuphandlers import remove_custom_googlebot from uuid import uuid4 from zope.schema import getFields -from plone.base.utils import get_installer import json import logging diff --git a/src/redturtle/volto/upgrades.zcml b/src/redturtle/volto/upgrades.zcml index 1014d94..8e8b91e 100644 --- a/src/redturtle/volto/upgrades.zcml +++ b/src/redturtle/volto/upgrades.zcml @@ -224,7 +224,7 @@ destination="4304" handler=".upgrades.update_registry" /> - Date: Thu, 28 Mar 2024 15:12:58 +0100 Subject: [PATCH 3/4] fix tests --- src/redturtle/volto/testing.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/redturtle/volto/testing.py b/src/redturtle/volto/testing.py index 81d9eb9..b1a227f 100644 --- a/src/redturtle/volto/testing.py +++ b/src/redturtle/volto/testing.py @@ -8,7 +8,7 @@ from plone.restapi.testing import PloneRestApiDXLayer from plone.testing import z2 -import collective.volto.cookieconsent +import collective.volto.gdprcookie import kitconcept.seo import plone.app.caching import plone.restapi @@ -23,7 +23,7 @@ def setUpZope(self, app, configurationContext): # Load any other ZCML that is required for your tests. # The z3c.autoinclude feature is disabled in the Plone fixture base # layer. - self.loadZCML(package=collective.volto.cookieconsent) + self.loadZCML(package=collective.volto.gdprcookie) self.loadZCML(package=plone.restapi) self.loadZCML(package=redturtle.volto) self.loadZCML(package=plone.volto) @@ -66,7 +66,7 @@ class RedturtleVoltoRestApiLayer(PloneRestApiDXLayer): def setUpZope(self, app, configurationContext): super(RedturtleVoltoRestApiLayer, self).setUpZope(app, configurationContext) - self.loadZCML(package=collective.volto.cookieconsent) + self.loadZCML(package=collective.volto.gdprcookie) self.loadZCML(package=plone.restapi) self.loadZCML(package=plone.volto) self.loadZCML(package=redturtle.volto) From 845fe10cc8dc251081700ef0c853fdc3f589227a Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Thu, 28 Mar 2024 15:19:41 +0100 Subject: [PATCH 4/4] fix plone52 compat --- src/redturtle/volto/upgrades.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/redturtle/volto/upgrades.py b/src/redturtle/volto/upgrades.py index 8c091fa..796ab3c 100644 --- a/src/redturtle/volto/upgrades.py +++ b/src/redturtle/volto/upgrades.py @@ -3,13 +3,18 @@ from copy import deepcopy from plone import api from plone.app.upgrade.utils import installOrReinstallProduct -from plone.base.utils import get_installer from plone.dexterity.utils import iterSchemata from plone.restapi.behaviors import IBlocks from redturtle.volto.setuphandlers import remove_custom_googlebot from uuid import uuid4 from zope.schema import getFields + +try: + from plone.base.utils import get_installer +except Exception: + from Products.CMFPlone.utils import get_installer + import json import logging