Refactor change description field serialization
Review Request #7766 — Created Nov. 12, 2015 and submitted
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 theChangeDescription
'sfields_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.