Don't share the extra_data instance between a review request and draft.

Review Request #6813 — Created Jan. 19, 2015 and submitted

Information

Review Board
release-2.0.x
10b08e4...

Reviewers

When creating a draft from a review request, the extra_data instance was
being assigned to the draft, instead of being copied over. This meant
that if any code tried to write into the draft's extra_data, it would
also appear in the review request's.

This was first noticed when attempting to do an API POST to the draft
resource that both changed an extra_data field on the draft and
published in one go. The publish code thought that the data hadn't been
changed, since it was in the shared extra_data, and would complain.

We now do a deepcopy of extra_data to prevent any sharing issues.

Added a new unit test that failed with the old behavior. It now passes.

All other unit tests pass too.

reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/webapi/tests/test_review_request_draft.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/webapi/tests/test_review_request_draft.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
mike_conley
  1. Yeah, this makes sense. Easy for something like that to slip by. +1 for the test!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (6da7fdd)