Skip to content

Commit

Permalink
Selectively pass query if it's in the request form
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Sep 5, 2024
1 parent 2deccce commit 32a415d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/plone/restapi/services/vocabularies/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ def reply(self):
404, "Not Found", f"The vocabulary '{vocabulary_name}' does not exist"
)

# some vocabularies (such as plone.app.vocabularies.Principals)
# allow passing a query parameter to their factory
query = self.request.form.get("title", "")
vocabulary = factory(self.context, query=query)
if query:
vocabulary = factory(self.context, query=query)
else:
vocabulary = factory(self.context)

serializer = getMultiAdapter(
(vocabulary, self.request), interface=ISerializeToJson
)
Expand Down

0 comments on commit 32a415d

Please sign in to comment.