Open all binary files as binary and save to storage using basenames.
Review Request #10481 — Created March 31, 2019 and submitted — Latest diff uploaded
This updates our various file opening calls to explicitly open any
binary files as binary. While not a real problem on Python 2.x, Python
3.x requires this in order to get byte strings out instead of Unicode
It also ensures that any time we write a file using a Django storage
backend, we're providing a basename and not a file path, in order to
avoid issues on Django 1.11.
Unit tests pass on Python 2.7 with Django 1.6 and 3.5-3.7 with
Django 1.11 (with other in-progress changes).