From 0a61660257b8770ac46090006046981718cfb3cb Mon Sep 17 00:00:00 2001 From: davisagli Date: Thu, 21 Sep 2023 13:44:51 -0700 Subject: [PATCH] [fc] Repository: plone.restapi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Branch: refs/heads/main Date: 2023-09-21T13:44:51-07:00 Author: David Glick (davisagli) Commit: https://github.com/plone/plone.restapi/commit/8e2786a656f4b16868efe562f26acbd13cde1fa7 Support getting /@querystring vocabs in context (#1704) * Support getting /@querystring vocabs in context * changelog * Add test, update docs * Update docs/source/endpoints/querystring.md Co-authored-by: Steve Piercy <web@stevepiercy.com> --------- Co-authored-by: Víctor Fernández de Alba <sneridagh@gmail.com> Co-authored-by: Steve Piercy <web@stevepiercy.com> Co-authored-by: Timo Stollenwerk <tisto@users.noreply.github.com> Files changed: A news/1704.feature A src/plone/restapi/tests/http-examples/querystring_get_contextual.req A src/plone/restapi/tests/http-examples/querystring_get_contextual.resp M docs/source/endpoints/querystring.md M src/plone/restapi/services/querystring/configure.zcml M src/plone/restapi/services/querystring/get.py M src/plone/restapi/tests/test_documentation.py --- last_commit.txt | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index 54677a4ce1..7d8bcb3e0e 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -2,43 +2,36 @@ Repository: plone.restapi Branch: refs/heads/main -Date: 2023-09-21T20:24:27+02:00 -Author: Timo Stollenwerk (tisto) -Commit: https://github.com/plone/plone.restapi/commit/4398aad066be2ad1b076466004f4be974351d79f +Date: 2023-09-21T13:44:51-07:00 +Author: David Glick (davisagli) +Commit: https://github.com/plone/plone.restapi/commit/8e2786a656f4b16868efe562f26acbd13cde1fa7 -Plone 6.0.7 (#1706) +Support getting /@querystring vocabs in context (#1704) -* Upgrade to Plone 6.0.7 +* Support getting /@querystring vocabs in context -* Update documentation tests after upgrade to Plone 6.0.7 +* changelog -* Upgrade requirements to Plone 6.0.7 as well +* Add test, update docs -* Add towncrier entry +* Update docs/source/endpoints/querystring.md -* comment out sphinxbuilder and sphinx-python on base.cfg to debug GHA - -* Upgrade from Plone 5.2.12 to 5.2.14 - -* No need to pin plone.rest to 3.0.0 for Plone 5.2 any longer - -* Re-add plone.rest pin to version 3. - -* Pass content_type when updating portrait +Co-authored-by: Steve Piercy <web@stevepiercy.com> --------- -Co-authored-by: David Glick <david@glicksoftware.com> +Co-authored-by: Víctor Fernández de Alba <sneridagh@gmail.com> +Co-authored-by: Steve Piercy <web@stevepiercy.com> +Co-authored-by: Timo Stollenwerk <tisto@users.noreply.github.com> Files changed: -A news/1706.internal -M base.cfg -M plone-5.2.x.cfg -M plone-6.0.x.cfg -M requirements-5.2.txt -M requirements-6.0.txt -M src/plone/restapi/services/users/update.py -M src/plone/restapi/tests/http-examples/registry_get_list.resp +A news/1704.feature +A src/plone/restapi/tests/http-examples/querystring_get_contextual.req +A src/plone/restapi/tests/http-examples/querystring_get_contextual.resp +M docs/source/endpoints/querystring.md +M src/plone/restapi/services/querystring/configure.zcml +M src/plone/restapi/services/querystring/get.py +M src/plone/restapi/tests/test_documentation.py -b'diff --git a/base.cfg b/base.cfg\nindex c34253a09..a1b05f41b 100644\n--- a/base.cfg\n+++ b/base.cfg\n@@ -9,8 +9,8 @@ parts =\n dependencies\n update-translations\n find-untranslated\n- sphinxbuilder\n- sphinx-python\n+# sphinxbuilder\n+# sphinx-python\n deploy-to-heroku\n omelette\n zpretty\ndiff --git a/news/1706.internal b/news/1706.internal\nnew file mode 100644\nindex 000000000..28ce56820\n--- /dev/null\n+++ b/news/1706.internal\n@@ -0,0 +1 @@\n+- Upgrade buildout: Plone 6.0.6 -> 6.0.7 and Plone 5.2.12 -> 5.2.14 @tisto\n\\ No newline at end of file\ndiff --git a/plone-5.2.x.cfg b/plone-5.2.x.cfg\nindex 4c0929114..158b669f2 100644\n--- a/plone-5.2.x.cfg\n+++ b/plone-5.2.x.cfg\n@@ -1,10 +1,10 @@\n [buildout]\n extends =\n- https://dist.plone.org/release/5.2.12/versions.cfg\n+ https://dist.plone.org/release/5.2.14/versions.cfg\n base.cfg\n \n [versions]\n black = 22.3.0\n \n-# Use the newest plone.rest\n-plone.rest = 3.0.0\n+# we need the newest plone.rest release\n+plone.rest = 3.0.1\n\\ No newline at end of file\ndiff --git a/plone-6.0.x.cfg b/plone-6.0.x.cfg\nindex 9f51f9e92..b29740736 100644\n--- a/plone-6.0.x.cfg\n+++ b/plone-6.0.x.cfg\n@@ -1,6 +1,6 @@\n [buildout]\n extends =\n- https://dist.plone.org/release/6.0.6/versions.cfg\n+ https://dist.plone.org/release/6.0.7/versions.cfg\n base.cfg\n \n [buildout:python37]\ndiff --git a/requirements-5.2.txt b/requirements-5.2.txt\nindex f2e443e3f..fccf56f7a 100644\n--- a/requirements-5.2.txt\n+++ b/requirements-5.2.txt\n@@ -1,2 +1,2 @@\n--r https://dist.plone.org/release/5.2.12/requirements.txt\n+-r https://dist.plone.org/release/5.2.14/requirements.txt\n zpretty\ndiff --git a/requirements-6.0.txt b/requirements-6.0.txt\nindex 7d4750742..dcd3abcf1 100644\n--- a/requirements-6.0.txt\n+++ b/requirements-6.0.txt\n@@ -1 +1 @@\n--r https://dist.plone.org/release/6.0.6/requirements.txt\n+-r https://dist.plone.org/release/6.0.7/requirements.txt\ndiff --git a/src/plone/restapi/services/users/update.py b/src/plone/restapi/services/users/update.py\nindex c89dd0b03..0e07d69d0 100644\n--- a/src/plone/restapi/services/users/update.py\n+++ b/src/plone/restapi/services/users/update.py\n@@ -185,6 +185,6 @@ def set_member_portrait(self, user, portrait):\n # frontend\n scaled = data\n \n- portrait = Image(id=safe_id, file=scaled, title="")\n+ portrait = Image(id=safe_id, file=scaled, title="", content_type=content_type)\n membertool = getToolByName(self, "portal_memberdata")\n membertool._setPortrait(portrait, safe_id)\ndiff --git a/src/plone/restapi/tests/http-examples/registry_get_list.resp b/src/plone/restapi/tests/http-examples/registry_get_list.resp\nindex dbc4259ef..daaee85fa 100644\n--- a/src/plone/restapi/tests/http-examples/registry_get_list.resp\n+++ b/src/plone/restapi/tests/http-examples/registry_get_list.resp\n@@ -6,7 +6,7 @@ Content-Type: application/json\n "batching": {\n "@id": "http://localhost:55001/plone/@registry",\n "first": "http://localhost:55001/plone/@registry?b_start=0",\n- "last": "http://localhost:55001/plone/@registry?b_start=2850",\n+ "last": "http://localhost:55001/plone/@registry?b_start=2950",\n "next": "http://localhost:55001/plone/@registry?b_start=25"\n },\n "items": [\n@@ -423,5 +423,5 @@ Content-Type: application/json\n "value": "The person that created an item"\n }\n ],\n- "items_total": 2875\n+ "items_total": 2972\n }\n' +b'diff --git a/docs/source/endpoints/querystring.md b/docs/source/endpoints/querystring.md\nindex 03c6e6ef38..b376fa0625 100644\n--- a/docs/source/endpoints/querystring.md\n+++ b/docs/source/endpoints/querystring.md\n@@ -1,40 +1,36 @@\n ---\n myst:\n html_meta:\n- "description": "The @querystring endpoint returns the querystring configuration of plone.app.querystring."\n- "property=og:description": "The @querystring endpoint returns the querystring configuration of plone.app.querystring."\n+ "description": "The @querystring endpoint returns metadata about available query operations."\n+ "property=og:description": "The @querystring endpoint returns metadata about available query operations."\n "property=og:title": "Querystring"\n "keywords": "Plone, plone.restapi, REST, API, Querystring"\n ---\n \n # Querystring\n \n-The `@querystring` endpoint returns the `querystring` configuration of `plone.app.querystring`.\n+The `@querystring` endpoint returns metadata about the query operations that can be performed using the [`@querystringsearch`](querystringsearch) endpoint.\n \n-Instead of simply exposing the `querystring` related `field` and `operation` entries from the registry, it serializes them in the same way that `p.a.querystring` does in its `@@querybuilderjsonconfig` view.\n+The results include all of the indexes that can be queried, along with metadata about each index.\n+The top-level `indexes` property includes all indexes, and the top-level `sortable_indexes` property includes only the indexes that can be used to sort.\n \n-This form is structured in a more convenient way for frontends to process:\n+Each index result includes a list of the query operations that can be performed on that index.\n+The `operations` property contains the list of operations as dotted names.\n+The `operators` property contains additional metadata about each operation.\n \n-- *Vocabularies* will be resolved.\n- Their values will be inlined in the `values` property.\n-- *Operations* will be inlined as well.\n- The `operations` property will contain the list of operations as dotted names.\n- The `operators` property will contain the full definition of each of those operations supported by that field.\n-- Indexes that are flagged as *sortable* are listed in a dedicated top-level property `sortable_indexes`.\n+If an index uses a vocabulary, the vocabulary values are included in the `values` property.\n+The vocabulary is resolved in the same context where the `/@querystring` endpoint is called (requires `plone.app.querystring >= 2.1.0`).\n \n-Available options for the querystring in a Plone site can be queried by interacting with the `/@querystring` endpoint on the portal root:\n+## Get `querystring` configuration\n \n-\n-## Querystring Config\n-\n-To retrieve all `querystring` options in the portal, call the `/@querystring` endpoint with a `GET` request:\n+To get the metadata about all query operations available in the portal, call the `/@querystring` endpoint with a `GET` request:\n \n ```{eval-rst}\n .. http:example:: curl httpie python-requests\n :request: ../../../src/plone/restapi/tests/http-examples/querystring_get.req\n ```\n \n-The server will respond with all `querystring` options in the portal:\n+The server will respond with the metadata:\n \n ```{literalinclude} ../../../src/plone/restapi/tests/http-examples/querystring_get.resp\n :language: http\ndiff --git a/news/1704.feature b/news/1704.feature\nnew file mode 100644\nindex 0000000000..e6f9ca41cd\n--- /dev/null\n+++ b/news/1704.feature\n@@ -0,0 +1 @@\n+Add support for getting the `/@querystring` endpoint in a specific context. @davisagli\ndiff --git a/src/plone/restapi/services/querystring/configure.zcml b/src/plone/restapi/services/querystring/configure.zcml\nindex 0cc223e650..f7e6f38343 100644\n--- a/src/plone/restapi/services/querystring/configure.zcml\n+++ b/src/plone/restapi/services/querystring/configure.zcml\n@@ -12,6 +12,15 @@\n permission="zope2.View"\n name="@querystring"\n />\n+\n+ \n+\n