Support buffer/memoryview types in Base64Field.

Review Request #10843 — Created Jan. 21, 2020 and submitted — Latest diff uploaded

Information

Djblets
release-2.0.x

Reviewers

Django can end up giving us a buffer (Python 2.x) or memoryview
(Python 3.x) value when instantiating a field from a row in the
database. This wasn't supported in Base64Field, and led to breakages
in one part of the administration UI.

This extends Base64Field to work correctly with a six.memoryview
(which maps to the correct type on both versions of Python). Unit tests
ensure that all the type-specific behavior will work correctly when
provided with these values.

Unit tests pass on all supported versions of Python.

Verified that I was able to load the objects in the administration UI
that were triggering this bug.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Support buffer/memoryview types in Base64Field.
Django can end up giving us a `buffer` (Python 2.x) or `memoryview` (Python 3.x) value when instantiating a field from a row in the database. This wasn't supported in `Base64Field`, and led to breakages in one part of the administration UI. This extends `Base64Field` to work correctly with a `six.memoryview` (which maps to the correct type on both versions of Python). Unit tests ensure that all the type-specific behavior will work correctly when provided with these values.
e318650a21f4807807b0d9fa73040b5219250ea8 Christian Hammond
djblets/db/fields/base64_field.py
djblets/db/tests/test_base64_field.py
Loading...