Modernize, bullet-proof, and document Base64Field.

Review Request #9752 — Created March 6, 2018 and submitted


Base64Field is one of the oldest pieces of code in Djblets,
responsible for taking arbitrary string data and storing it as Base64
content in the database. It relied on some older ways of working with
strings and Django fields, had very little documentation, and absolutely
no test cases.

This change updates it, bringing it in line with our modern coding and
documentation standards. In the process, it also fixes a number of
issues with the field, ensuring that value types passed in are
compatible, encoding Unicode strings to byte strings, explicitly making
Base64DecodedValue a byte string instead of a native string, and
replacing legacy cruft in the field implementation.

Unit tests were added that run through all the ways that values can be
checked and converted and makes sure that we always get the end results
we expect.

Djblets unit tests pass on Python 2.7, 3.4, 3.5, and 3.6.

Review Board test suite passes.

Built the docs and checked for formatting and build errors.

  1. Ship It!
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (27a9bd8)