Support buffer/memoryview types in Base64Field.

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

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.

Summary ID
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
Description From Last Updated

F811 redefinition of unused 'test_unsaved_obj_with_base64_decoded_value' from line 122

reviewbotreviewbot

F811 redefinition of unused 'test_saved_obj_with_base64_decoded_value' from line 195

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (469a0fa)