Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undeprecate comma-separated list of expansion #1707

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/1696.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Undeprecate comma separated expansion parameters (that were deprecated in plone.restapi 8) @tisto
9 changes: 2 additions & 7 deletions src/plone/restapi/serializer/expansion.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
from plone.restapi.interfaces import IExpandableElement
from zope.component import getAdapters

import warnings


def expandable_elements(context, request):
"""Returns a dict containing all expandable elements."""
expands = request.form.get("expand", [])
if isinstance(expands, str):
if "," in expands:
# deprecated use of expands (with commas)
warnings.warn(
"``expand`` as a string parameter separated with commas is deprecated and will be removed in plone.restapi 9.0. Use ``expand:list`` instead.",
DeprecationWarning,
)
# use of expands (with commas) was deprecated in plone.restapi 8
# undeprecated with plone.restapi 9
expands = expands.split(",")
else:
# allow still the use of non marked :list parameters present
Expand Down