diff --git a/last_commit.txt b/last_commit.txt index c94a28e3fb..3f439ecc9f 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -2,63 +2,31 @@ Repository: plone.app.querystring Branch: refs/heads/master -Date: 2023-09-19T13:34:08-07:00 +Date: 2023-09-21T08:32:35-07:00 Author: David Glick (davisagli) -Commit: https://github.com/plone/plone.app.querystring/commit/51d91d7444429d520d5368834c9984bbe9c449b6 +Commit: https://github.com/plone/plone.app.querystring/commit/dd18ce0e2920f5010990de34c3e7374ef094aad9 -Support getting querystring vocabs in context +Preparing release 2.1.0 Files changed: -M plone/app/querystring/registryreader.py +M CHANGES.rst +M setup.py +D news/137.feature -b'diff --git a/plone/app/querystring/registryreader.py b/plone/app/querystring/registryreader.py\nindex 5926a5f..ad6e23f 100644\n--- a/plone/app/querystring/registryreader.py\n+++ b/plone/app/querystring/registryreader.py\n@@ -42,6 +42,7 @@ def __init__(self, context, request=None):\n request = getRequest()\n \n self.context = context\n+ self.vocab_context = context\n self.request = request\n \n def parseRegistry(self):\n@@ -87,7 +88,7 @@ def getVocabularyValues(self, values):\n # Bail out if the annotation is marked not to fetch the vocabulary\n # to allow the widget to query the vocabulary as needed\n continue\n- for item in utility(self.context):\n+ for item in utility(self.vocab_context):\n if isinstance(item.title, Message):\n title = translate(item.title, context=self.request)\n else:\n' +b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 90c69bf..00d0dab 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -8,6 +8,15 @@ Changelog\n \n .. towncrier release notes start\n \n+2.1.0 (2023-09-21)\n+------------------\n+\n+New features:\n+\n+\n+- Add a way to specific a context for getting vocabularies in the QuerystringRegistryReader. @davisagli (#137)\n+\n+\n 2.0.6 (2023-08-17)\n ------------------\n \ndiff --git a/news/137.feature b/news/137.feature\ndeleted file mode 100644\nindex 17bac84..0000000\n--- a/news/137.feature\n+++ /dev/null\n@@ -1 +0,0 @@\n-Add a way to specific a context for getting vocabularies in the QuerystringRegistryReader. @davisagli\ndiff --git a/setup.py b/setup.py\nindex 258b709..629b54c 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -2,7 +2,7 @@\n from setuptools import setup\n \n \n-version = "2.0.7.dev0"\n+version = "2.1.0"\n \n long_description = open("README.rst").read() + "\\n"\n long_description += open("CHANGES.rst").read()\n' Repository: plone.app.querystring Branch: refs/heads/master -Date: 2023-09-19T22:46:00-07:00 +Date: 2023-09-21T08:34:34-07:00 Author: David Glick (davisagli) -Commit: https://github.com/plone/plone.app.querystring/commit/c88657c95c77d92a505f2affe771dfd929a53684 +Commit: https://github.com/plone/plone.app.querystring/commit/68d49d966f86966a6109c4f90e71cc2841f1f1e6 -changelog +Back to development: 2.1.1 Files changed: -A news/137.feature +M setup.py -b'diff --git a/news/137.feature b/news/137.feature\nnew file mode 100644\nindex 0000000..17bac84\n--- /dev/null\n+++ b/news/137.feature\n@@ -0,0 +1 @@\n+Add a way to specific a context for getting vocabularies in the QuerystringRegistryReader. @davisagli\n' - -Repository: plone.app.querystring - - -Branch: refs/heads/master -Date: 2023-09-20T12:19:18-07:00 -Author: David Glick (davisagli) -Commit: https://github.com/plone/plone.app.querystring/commit/118ad82fefd7a7d2d1b31e31cdb6b012eb2e4dd2 - -add test - -Files changed: -M plone/app/querystring/tests/testRegistryReader.py - -b'diff --git a/plone/app/querystring/tests/testRegistryReader.py b/plone/app/querystring/tests/testRegistryReader.py\nindex f348bcd..962ad68 100644\n--- a/plone/app/querystring/tests/testRegistryReader.py\n+++ b/plone/app/querystring/tests/testRegistryReader.py\n@@ -15,7 +15,8 @@\n @implementer(IVocabularyFactory)\n class TestVocabulary:\n def __call__(self, context):\n- return SimpleVocabulary([SimpleVocabulary.createTerm("foo", "foo", "bar")])\n+ term = "subsite term" if getattr(context, "id", None) == "subsite" else "term"\n+ return SimpleVocabulary([SimpleVocabulary.createTerm(term, term, term)])\n \n \n class TestRegistryReader(unittest.TestCase):\n@@ -82,7 +83,19 @@ def test_get_vocabularies(self):\n result = reader.parseRegistry()\n result = reader.getVocabularyValues(result)\n vocabulary_result = result.get("plone.app.querystring.field.reviewState.values")\n- self.assertEqual(vocabulary_result, {"foo": {"title": "bar"}})\n+ self.assertEqual(vocabulary_result, {"term": {"title": "term"}})\n+\n+ def test_get_vocabularies_in_context(self):\n+ portal = self.layer["portal"]\n+ subsite = portal[portal.invokeFactory("Document", "subsite", title="Subsite")]\n+\n+ registry = self.createRegistry(td.test_vocabulary_xml)\n+ reader = IQuerystringRegistryReader(registry)\n+ reader.vocab_context = subsite\n+ result = reader.parseRegistry()\n+ result = reader.getVocabularyValues(result)\n+ vocabulary_result = result.get("plone.app.querystring.field.reviewState.values")\n+ self.assertEqual(vocabulary_result, {"subsite term": {"title": "subsite term"}})\n \n def test_map_operations_clean(self):\n """tests if mapOperations is getting all operators correctly"""\n' - -Repository: plone.app.querystring - - -Branch: refs/heads/master -Date: 2023-09-21T07:40:36-07:00 -Author: David Glick (davisagli) -Commit: https://github.com/plone/plone.app.querystring/commit/c2e7f3abb8b32f026d4ddd85b5122fbe0c2b21fa - -Merge pull request #137 from plone/contextual-vocabs - -Support getting querystring vocabs in context - -Files changed: -A news/137.feature -M plone/app/querystring/registryreader.py -M plone/app/querystring/tests/testRegistryReader.py - -b'diff --git a/news/137.feature b/news/137.feature\nnew file mode 100644\nindex 0000000..17bac84\n--- /dev/null\n+++ b/news/137.feature\n@@ -0,0 +1 @@\n+Add a way to specific a context for getting vocabularies in the QuerystringRegistryReader. @davisagli\ndiff --git a/plone/app/querystring/registryreader.py b/plone/app/querystring/registryreader.py\nindex 5926a5f..ad6e23f 100644\n--- a/plone/app/querystring/registryreader.py\n+++ b/plone/app/querystring/registryreader.py\n@@ -42,6 +42,7 @@ def __init__(self, context, request=None):\n request = getRequest()\n \n self.context = context\n+ self.vocab_context = context\n self.request = request\n \n def parseRegistry(self):\n@@ -87,7 +88,7 @@ def getVocabularyValues(self, values):\n # Bail out if the annotation is marked not to fetch the vocabulary\n # to allow the widget to query the vocabulary as needed\n continue\n- for item in utility(self.context):\n+ for item in utility(self.vocab_context):\n if isinstance(item.title, Message):\n title = translate(item.title, context=self.request)\n else:\ndiff --git a/plone/app/querystring/tests/testRegistryReader.py b/plone/app/querystring/tests/testRegistryReader.py\nindex f348bcd..962ad68 100644\n--- a/plone/app/querystring/tests/testRegistryReader.py\n+++ b/plone/app/querystring/tests/testRegistryReader.py\n@@ -15,7 +15,8 @@\n @implementer(IVocabularyFactory)\n class TestVocabulary:\n def __call__(self, context):\n- return SimpleVocabulary([SimpleVocabulary.createTerm("foo", "foo", "bar")])\n+ term = "subsite term" if getattr(context, "id", None) == "subsite" else "term"\n+ return SimpleVocabulary([SimpleVocabulary.createTerm(term, term, term)])\n \n \n class TestRegistryReader(unittest.TestCase):\n@@ -82,7 +83,19 @@ def test_get_vocabularies(self):\n result = reader.parseRegistry()\n result = reader.getVocabularyValues(result)\n vocabulary_result = result.get("plone.app.querystring.field.reviewState.values")\n- self.assertEqual(vocabulary_result, {"foo": {"title": "bar"}})\n+ self.assertEqual(vocabulary_result, {"term": {"title": "term"}})\n+\n+ def test_get_vocabularies_in_context(self):\n+ portal = self.layer["portal"]\n+ subsite = portal[portal.invokeFactory("Document", "subsite", title="Subsite")]\n+\n+ registry = self.createRegistry(td.test_vocabulary_xml)\n+ reader = IQuerystringRegistryReader(registry)\n+ reader.vocab_context = subsite\n+ result = reader.parseRegistry()\n+ result = reader.getVocabularyValues(result)\n+ vocabulary_result = result.get("plone.app.querystring.field.reviewState.values")\n+ self.assertEqual(vocabulary_result, {"subsite term": {"title": "subsite term"}})\n \n def test_map_operations_clean(self):\n """tests if mapOperations is getting all operators correctly"""\n' +b'diff --git a/setup.py b/setup.py\nindex 629b54c..4a42497 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -2,7 +2,7 @@\n from setuptools import setup\n \n \n-version = "2.1.0"\n+version = "2.1.1.dev0"\n \n long_description = open("README.rst").read() + "\\n"\n long_description += open("CHANGES.rst").read()\n'