Skip to content

Commit

Permalink
Remove deprecated token parameter from vocabularies endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Aug 28, 2023
1 parent b58560e commit 05f416b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
1 change: 1 addition & 0 deletions news/1697.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecated token parameter from vocabularies endpoint. @tisto
15 changes: 3 additions & 12 deletions src/plone/restapi/serializer/vocabularies.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,21 @@ def __init__(self, context, request):
def __call__(self, vocabulary_id):
vocabulary = self.context
title = safe_text(self.request.form.get("title", ""))
token = self.request.form.get("token", "")
tokens = self.request.form.get("tokens", [])
b_size = self.request.form.get("b_size", "")

terms = []
for term in vocabulary:
if title and token:
if title and tokens:
self.request.response.setStatus(400)
return dict(
error=dict(
type="Invalid parameters",
message="You can not filter by title and token at the same time.",
message="You can not filter by title and tokens at the same time.",
) # noqa
)

if token:
warnings.warn(
"``token`` parameter is deprecated and will be removed in plone.restapi 9.0. Use ``tokens`` parameter instead.",
DeprecationWarning,
)
if token.lower() != term.token.lower():
continue
terms.append(term)
elif tokens:
if tokens:
if isinstance(tokens, str):
tokens = [tokens]
for item in tokens:
Expand Down

0 comments on commit 05f416b

Please sign in to comment.