Fix circular references in all API resources.

Review Request #7654 — Created Sept. 21, 2015 and submitted — Latest diff uploaded

Information

Djblets
release-0.9.x
1e341a6...

Reviewers

Once upon a time, I had fixed circular references in the API serialization.
This regressed with the introduction of field limiting.

The core problem was that for foreign key and queryset types, we'd just
serialize that field as the list of objects, rather than recursing and asking
each of those to serialize themselves using the current state. Since the list
of expanded fields will always be the same when the encoder tried to serialize
using the global state, we'd hit the circular reference.

By asking each of those objects to serialize themselves with the limited list
of expanded fields, we'll only recurse once for each type.

  • Set up two review requests which depended on each other. Saw that I could
    make changes to their drafts.
  • Added a new unit test and fixed existing unit tests to test the correct
    behavior.
    Loading...