Fix up some string types.
Review Request #12106 — Created March 7, 2022 and submitted
This change fixes up a handful of issues related to string types. Some
of these are more important than others.
For a couple places, we had code deep in the diff rendering which was
SafeString. Because we have caching at many levels in the
diff viewer, these values would end up trying to go through pickle to
store the rendered data. When pickle encounters a value that it doesn't
understand, it tries to call
str()on it. With the older Django
version, this would correctly convert, but with the modern Django,
SafeStringwould return the
This would just end up infinitely recursing inside of the pickle
machinery. There are two places where this affects. For the first, the
fix is to remove some old
mark_safecalls. For the second (where we
were rendering a template), the solution is to explicitly convert to
strby using a slice trick.
Next, the HTTP digest authentication backend was calling MD5, but
passing in an
bytes. We also had a handful of other
places where there was some confusion about bytes/str which was found
via static analysis.
Finally, a bunch of unit tests were passing in
inttypes for the
revision when creating test filediffs. These do end up getting cast to
str, but since we say the type of the argument is str, it's more correct
to pass that in directly.
- Created a review request with a diff and was able to successfully load
the diff viewer page.
- Ran unit tests.
I saw the bit in the description about this, but I really don't like it. This is a valid part …
Revision 2 (+208 -234)
Checks run (2 succeeded)