Skip to content

Commit

Permalink
Undeprecate comma-separated list of expansion (#1707)
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Sep 21, 2023
1 parent 8e2786a commit 863d9a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
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

0 comments on commit 863d9a2

Please sign in to comment.