diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index d2573b6..a5bf3a8 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 97c7dfa..0ccd634 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/pyroma.yml b/.github/workflows/pyroma.yml index bbad3c2..ad5ad14 100644 --- a/.github/workflows/pyroma.yml +++ b/.github/workflows/pyroma.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/zpretty.yml b/.github/workflows/zpretty.yml index 180f0e9..a6c3003 100644 --- a/.github/workflows/zpretty.yml +++ b/.github/workflows/zpretty.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.gitignore b/.gitignore index 70ae3c9..a8ffe19 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store .coverage .coverage.* .python-version diff --git a/CHANGES.rst b/CHANGES.rst index 549ef1b..4c3f0b7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,7 +7,10 @@ Changelog - Fix mapping for Persona. [daniele] - +- Remove tipoligia_notizia taxonomy (from v3) and index v2 field. + [cekk] +- Re-add tipologia_notizia criteria. + [cekk] 1.0.3 (2024-06-24) ------------------ diff --git a/src/design/plone/ctgeneric/configure.zcml b/src/design/plone/ctgeneric/configure.zcml index bf49357..8f4b6f4 100644 --- a/src/design/plone/ctgeneric/configure.zcml +++ b/src/design/plone/ctgeneric/configure.zcml @@ -19,6 +19,7 @@ + @@ -53,5 +54,4 @@ name="ruolo" /> - diff --git a/src/design/plone/ctgeneric/profiles/default/catalog.xml b/src/design/plone/ctgeneric/profiles/default/catalog.xml index e82fc24..3cc2ce9 100644 --- a/src/design/plone/ctgeneric/profiles/default/catalog.xml +++ b/src/design/plone/ctgeneric/profiles/default/catalog.xml @@ -1,4 +1,9 @@ + + + + + diff --git a/src/design/plone/ctgeneric/profiles/default/metadata.xml b/src/design/plone/ctgeneric/profiles/default/metadata.xml index 8b421db..8eb10fa 100644 --- a/src/design/plone/ctgeneric/profiles/default/metadata.xml +++ b/src/design/plone/ctgeneric/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - + - 1000 + 1001 diff --git a/src/design/plone/ctgeneric/profiles/default/registry/criteria.xml b/src/design/plone/ctgeneric/profiles/default/registry/criteria.xml index 023fde3..4ebf484 100644 --- a/src/design/plone/ctgeneric/profiles/default/registry/criteria.xml +++ b/src/design/plone/ctgeneric/profiles/default/registry/criteria.xml @@ -24,6 +24,20 @@ >Metadata + + + Tipologia notizia + Tipologia della notizia + True + False + + plone.app.querystring.operation.selection.any + plone.app.querystring.operation.selection.all + + design.plone.vocabularies.tipologie_notizia + Metadata + + @@ -35,7 +49,6 @@ - diff --git a/src/design/plone/ctgeneric/setuphandlers.py b/src/design/plone/ctgeneric/setuphandlers.py index cd92769..32e3f7b 100644 --- a/src/design/plone/ctgeneric/setuphandlers.py +++ b/src/design/plone/ctgeneric/setuphandlers.py @@ -4,6 +4,10 @@ from Products.CMFPlone.interfaces import ISearchSchema from zope.component import getUtility from zope.interface import implementer +from plone import api +from collective.taxonomy.interfaces import ITaxonomy +from zope.i18n.interfaces import ITranslationDomain +from zope.schema.interfaces import IVocabularyFactory @implementer(INonInstallable) @@ -23,6 +27,7 @@ def post_install(context): """Post install script""" # Do something at the end of the installation of this package. disable_searchable_types() + delete_tipologia_notizia_taxonomy() def uninstall(context): @@ -44,3 +49,16 @@ def disable_searchable_types(): ] types = [x for x in settings.types_not_searched if x not in remove_types] settings.types_not_searched = tuple(types) + + +def delete_tipologia_notizia_taxonomy(): + portal = api.portal.get() + sm = portal.getSiteManager() + name = "collective.taxonomy.tipologia_notizia" + utility = sm.queryUtility(ITaxonomy, name=name) + if utility is None: + return + utility.unregisterBehavior() + sm.unregisterUtility(utility, ITaxonomy, name=name) + sm.unregisterUtility(utility, IVocabularyFactory, name=name) + sm.unregisterUtility(utility, ITranslationDomain, name=name) diff --git a/src/design/plone/ctgeneric/upgrades/1001.zcml b/src/design/plone/ctgeneric/upgrades/1001.zcml new file mode 100644 index 0000000..9ea71c2 --- /dev/null +++ b/src/design/plone/ctgeneric/upgrades/1001.zcml @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/src/design/plone/ctgeneric/upgrades/1001/.gitkeep b/src/design/plone/ctgeneric/upgrades/1001/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/design/plone/ctgeneric/upgrades/1001/catalog.xml b/src/design/plone/ctgeneric/upgrades/1001/catalog.xml new file mode 100644 index 0000000..d7c5956 --- /dev/null +++ b/src/design/plone/ctgeneric/upgrades/1001/catalog.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/design/plone/ctgeneric/upgrades/1001/metadata.txt b/src/design/plone/ctgeneric/upgrades/1001/metadata.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/design/plone/ctgeneric/upgrades/1001/registry.xml b/src/design/plone/ctgeneric/upgrades/1001/registry.xml new file mode 100644 index 0000000..022d799 --- /dev/null +++ b/src/design/plone/ctgeneric/upgrades/1001/registry.xml @@ -0,0 +1,17 @@ + + + + + Tipologia notizia + Tipologia della notizia + True + False + + plone.app.querystring.operation.selection.any + plone.app.querystring.operation.selection.all + + design.plone.vocabularies.tipologie_notizia + Metadata + + + diff --git a/src/design/plone/ctgeneric/upgrades/__init__.py b/src/design/plone/ctgeneric/upgrades/__init__.py new file mode 100644 index 0000000..151338a --- /dev/null +++ b/src/design/plone/ctgeneric/upgrades/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -* + +import logging + + +logger = logging.getLogger("design.plone.ctgeneric") diff --git a/src/design/plone/ctgeneric/upgrades/base.py b/src/design/plone/ctgeneric/upgrades/base.py new file mode 100644 index 0000000..eab162b --- /dev/null +++ b/src/design/plone/ctgeneric/upgrades/base.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from plone.app.upgrade.utils import loadMigrationProfile + + +def reload_gs_profile(context): + loadMigrationProfile( + context, + "profile-design.plone.ctgeneric:default", + ) diff --git a/src/design/plone/ctgeneric/upgrades/configure.zcml b/src/design/plone/ctgeneric/upgrades/configure.zcml new file mode 100644 index 0000000..c26291b --- /dev/null +++ b/src/design/plone/ctgeneric/upgrades/configure.zcml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/design/plone/ctgeneric/upgrades/v1001.py b/src/design/plone/ctgeneric/upgrades/v1001.py new file mode 100644 index 0000000..b416f1d --- /dev/null +++ b/src/design/plone/ctgeneric/upgrades/v1001.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from design.plone.ctgeneric.setuphandlers import delete_tipologia_notizia_taxonomy +from plone import api + +import logging + +logger = logging.getLogger(__name__) + + +def upgrade(setup_tool=None): + """ """ + delete_tipologia_notizia_taxonomy() + + setup_tool.runAllImportStepsFromProfile("design.plone.ctgeneric.upgrades:1001") + + brains = api.content.find(portal_type="News Item") + tot = len(brains) + i = 0 + for brain in brains: + i += 1 + if i % 100 == 0: + logger.info(f"Processing {i} of {tot}") + obj = brain.getObject() + if getattr(obj, "tipologia_notizia", ""): + obj.reindexObject(idxs=["tipologia_notizia"]) diff --git a/test_plone60.cfg b/test_plone60.cfg index a4ee877..e7bb7c2 100644 --- a/test_plone60.cfg +++ b/test_plone60.cfg @@ -41,10 +41,6 @@ collective.address = 1.6 # redturtle.volto==5.0.1 collective.purgebyid = 1.2.1 -# Required by: -# eea.api.taxonomy==1.5 -collective.taxonomy = 3.0.1 - # Required by: # redturtle.bandi==1.4.3 collective.tiles.collection = 2.0.0 @@ -65,10 +61,6 @@ collective.z3cform.datagridfield = 3.0.1 # zest.releaser==8.0.0 colorama = 0.4.6 -# Required by: -# design.plone.contenttypes==6.0.17.dev0 -eea.api.taxonomy = 1.5 - # Required by: # openpyxl==3.1.2 et-xmlfile = 1.1.0