Refactor change description field serialization

Review Request #7766 — Created Nov. 12, 2015 and submitted

Information

Review Board
release-2.0.x

Reviewers

Change description serialization has been refactored into three
methods:

  • serialization of lists of models,
  • serialization of lists of plain old data, and
  • serialization of singletons (which are stored as a list with a single
    element in the ChangeDescription's fields_fields field).

This allows for code de-duplication and consolidation for the
BaseReviewRequestField and BaseCommaEditableField. The logic for
serialization has also been corrected to only attempt to serialize
added and removed entries when they exist.

The serialization of lists of models has also been corrected.
Previously, there were no BaseReviewRequestField instances that
serialized lists of models. If there were, they would have thrown an
exception because the default implementation attempted to serialize
them from a tuple not wrapped within a list.

  • Ran unit tests.
  • Used this with an upcoming change; it worked correctly.
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/fields.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/fields.py
    
    
  2. 
      
brennie
david
  1. Ship It!
  2. 
      
brennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (11feecb)
Loading...