diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index da04be9..9502dc5 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -30,8 +30,6 @@ jobs: uses: plone/meta/.github/workflows/test.yml@main release_ready: uses: plone/meta/.github/workflows/release_ready.yml@main - circular: - uses: plone/meta/.github/workflows/circular.yml@main ## # To modify the list of default jobs being created add in .meta.toml: diff --git a/.gitignore b/.gitignore index 8067951..b231e87 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ parts/ pyvenv.cfg var/ local.cfg +.python-version # mxdev /instance/ diff --git a/.meta.toml b/.meta.toml index b965f34..1414a7f 100644 --- a/.meta.toml +++ b/.meta.toml @@ -13,7 +13,6 @@ jobs = [ "qa", "test", "release_ready", - "circular", ] [gitignore] diff --git a/CHANGES.rst b/CHANGES.rst index 8233920..cad1cf6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changes 3.1.2 (unreleased) ------------------ +- Fix keywords comparison + [mamico] + - Added Italian translation [mamico] diff --git a/src/collective/taxonomy/indexer.py b/src/collective/taxonomy/indexer.py index 008cc01..07fb5c7 100644 --- a/src/collective/taxonomy/indexer.py +++ b/src/collective/taxonomy/indexer.py @@ -1,6 +1,7 @@ from Acquisition import aq_base from Acquisition import aq_parent from collections.abc import Iterable +from collective.taxonomy import PATH_SEPARATOR from collective.taxonomy.interfaces import ITaxonomy from plone import api from plone.base.interfaces import IPloneSiteRoot @@ -62,7 +63,9 @@ def __call__(self): result = [] for key, value in utility.inverted_data[lang].items(): for found_identifier, found_language, found_path in found: - if found_path.startswith(value) and key not in result: + value_split = value.split(PATH_SEPARATOR) + found_split = found_path.split(PATH_SEPARATOR)[: len(value_split)] + if found_split == value_split and key not in result: result.append(key) return result diff --git a/src/collective/taxonomy/profiles/examples/taxonomies/nihms.xml b/src/collective/taxonomy/profiles/examples/taxonomies/nihms.xml index bce2c96..8a740e0 100644 --- a/src/collective/taxonomy/profiles/examples/taxonomies/nihms.xml +++ b/src/collective/taxonomy/profiles/examples/taxonomies/nihms.xml @@ -50,5 +50,11 @@ Cars + + 56 + + Carson + + diff --git a/src/collective/taxonomy/tests/test_controlpanel_restapi.py b/src/collective/taxonomy/tests/test_controlpanel_restapi.py index 27429bb..a4838e4 100644 --- a/src/collective/taxonomy/tests/test_controlpanel_restapi.py +++ b/src/collective/taxonomy/tests/test_controlpanel_restapi.py @@ -53,4 +53,4 @@ def test_default_values_loaded(self): self.assertEqual(len(res), 1) self.assertEqual(res[0]["name"], "collective.taxonomy.test") self.assertEqual(res[0]["title"], "Test vocabulary") - self.assertEqual(res[0]["count"], {"da": 4, "de": 1, "en": 5, "ru": 1}) + self.assertEqual(res[0]["count"], {"da": 4, "de": 1, "en": 6, "ru": 1}) diff --git a/src/collective/taxonomy/tests/test_indexer.py b/src/collective/taxonomy/tests/test_indexer.py index dc7e1af..249fa6f 100644 --- a/src/collective/taxonomy/tests/test_indexer.py +++ b/src/collective/taxonomy/tests/test_indexer.py @@ -127,6 +127,7 @@ def test_querystring_widget(self): ("3", {"title": "Information Science \xbb Chronology"}), ("5", {"title": "Information Science \xbb Sport"}), ("55", {"title": "Information Science \xbb Cars"}), + ("56", {"title": "Information Science \xbb Carson"}), ], ) @@ -145,11 +146,14 @@ def test_index_single_select(self): document_schema = fti.lookupSchema() notify(ObjectAddedEvent(taxonomy_test, document_schema)) notify(FieldAddedEvent(fti, taxonomy_test)) - taxo_val = taxonomy["en"]["\u241fInformation Science\u241fCars"] + taxo_val = taxonomy["en"]["\u241fInformation Science\u241fCarson"] self.document.taxonomy_test = taxo_val self.document.reindexObject() self.assertEqual(len(portal_catalog({"taxonomy_test": "5"})), 0) - self.assertEqual(len(portal_catalog({"taxonomy_test": "55"})), 1) + # not Cars ... + self.assertEqual(len(portal_catalog({"taxonomy_test": "55"})), 0) + # ... but Carson + self.assertEqual(len(portal_catalog({"taxonomy_test": "56"})), 1) def test_indexer_with_property(self): portal_catalog = api.portal.get_tool("portal_catalog") diff --git a/src/collective/taxonomy/tests/test_taxonomy_endpoint.py b/src/collective/taxonomy/tests/test_taxonomy_endpoint.py index 302a4da..239c34a 100644 --- a/src/collective/taxonomy/tests/test_taxonomy_endpoint.py +++ b/src/collective/taxonomy/tests/test_taxonomy_endpoint.py @@ -39,7 +39,7 @@ def test_get_without_parameters_return_all_taxonomies(self): self.assertEqual(len(res), 1) self.assertEqual(res[0]["name"], "collective.taxonomy.test") self.assertEqual(res[0]["title"], "Test vocabulary") - self.assertEqual(res[0]["count"], {"da": 4, "de": 1, "en": 5, "ru": 1}) + self.assertEqual(res[0]["count"], {"da": 4, "de": 1, "en": 6, "ru": 1}) def test_get_with_parameters_return_taxonomy_details(self): response = self.api_session.get("/@taxonomy/collective.taxonomy.test") diff --git a/src/collective/taxonomy/tests/test_utility.py b/src/collective/taxonomy/tests/test_utility.py index 0085511..ab4b9b7 100644 --- a/src/collective/taxonomy/tests/test_utility.py +++ b/src/collective/taxonomy/tests/test_utility.py @@ -14,4 +14,4 @@ def test_make_tree(self): tree = taxonomy.makeVocabulary("en").makeTree() self.assertIn("Information Science", tree) - self.assertEqual(len(tree["Information Science"]), 4) + self.assertEqual(len(tree["Information Science"]), 5)