reviewboard/hostingsvcs/gerrit.py (Diff revision 1)Show all issues
Review Request #10930 — Created March 2, 2020 and submitted
The Gerrit hosting service had some compatibility issues with Python 3,
and this was due to a queryset ordering discrepency issue that was
solved in Review Board 4.0's hosting service client rewrite.
Rather than take the easy route and apply the same fix to Gerrit's code,
this change updates the Gerrit codebase to make full use of the modern
client support. We now use the request/response capabilities in that
rewrite to better control how authentication is performed and to use the
standard methods for performing HTTP requests, allowing us to remove the
Since Gerrit's API has a security-related quirk where it prefixes JSON
payloads with a string we have to filter out, we still needed a way to
strip this out in a standard way. Previously, we overrode a private
HostingServiceClientto do this, which wasn't future-proof.
Now, as part of this change, a
HostingServiceClientcan designate a
HostingServiceHTTPResponseto use for all responses, which
the Gerrit implementation uses in order to strip out this prefix when
requesting a JSON-deserialized response.
Manually tested linking a new repository and account, viewing branches,
listing commits, and posting commits for review.
Unit tests pass.
F821 undefined name 'url'
Fixed a bad variable reference in an error logging statement.
Revision 2 (+266 -292)