Always return a copy of data in WebAPIResource.serialize_object.

Review Request #7428 — Created June 15, 2015 and submitted

Information

Djblets
release-0.8.x
fb5acd6...

Reviewers

The first time serialize_object built a payload, it would store a copy
of it, and then return the original. The copy was intended to be an
original version of the data that the caller couldn't mess with.

However, a second call would return the copy directly. If the caller
then modified it, a third call would end up being affected.

We now always return a copy, and never the original payload.

The new unit test failed before this. Works after.

I also tested the repro case found in Review Board, which failed before
this and worked after.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/webapi/resources.py
        djblets/webapi/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/webapi/resources.py
        djblets/webapi/tests.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.8.x (f643a61)
Loading...