Serialize with the correct resource using get_serializer_for_object.

Review Request #5695 — Created April 10, 2014 and submitted — Latest diff uploaded

Information

Djblets
master
d274b35...

Reviewers

The new get_serializer_for_object wasn't reliable enough, since it would
only work in certain circumstances. Any time the JSON encoder was used
to serialize part of a resource, it'd end up using the wrong resource to
serialize.

Now, when WebAPIResource serializes a payload, it passes itself as a
special parameter for use during serialization. This is used as a handle
for determining what to call get_serializer_for_object on.

With this, it should now be possible to always override serialization
for any object, reliably.

RB and Djblets unit tests pass.

Used this in a resource successfully. It was failing before.

    Loading...