Skip to content

Commit

Permalink
remove envelope -> sideloading dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
aleontiev committed Jan 30, 2017
1 parent b7de56b commit c3dc784
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions dynamic_rest/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(
debug=False,
dynamic=True,
embed=False,
envelope=None,
envelope=False,
**kwargs
):
"""
Expand All @@ -182,8 +182,7 @@ def __init__(
If None (default), respect descendents' embed parameters.
dynamic: If False, disable inclusion / exclusion features.
envelope: If True, wrap `.data` in an envelope.
If False, do not use an envelope and disable sideloading.
If None, do not use an envelope.
If False, do not use an envelope.
"""
name = self.get_name()
if data is not fields.empty and name in data and len(data) == 1:
Expand Down Expand Up @@ -213,19 +212,13 @@ def __init__(
super(WithDynamicSerializerMixin, self).__init__(**kwargs)

self.envelope = envelope
self.sideloading = sideloading
self.debug = debug
self.dynamic = dynamic
self.request_fields = request_fields or {}

# sideloading modifies top-level response keys,
# so it requires an envelope
if envelope is False:
sideloading = False

# `embed` is overriden by `sideloading`
embed = embed if sideloading is None else not sideloading

self.sideloading = sideloading
self.embed = embed

self._dynamic_init(only_fields, include_fields, exclude_fields)
Expand Down

0 comments on commit c3dc784

Please sign in to comment.