Encode non-string query parameters as strings

Review Request #10685 — Created Sept. 6, 2019 and submitted — Latest diff uploaded

Information

RBTools
release-1.0.x

Reviewers

There are a few cases where we are passing non-string arguments to
methods that make API calls, which was fine in the past. However, we are
now assuming that all arguments are strings and erroring out if they are
not.

Instead, we now make a best-case attempt to serialize values to strings
and produces a better error message when this process fails.

Confirmed the following hold true on Python versions 2.7, 3.5, 3.6, and
3.7:

  • With this patch applied, rbt status prints the list of status, where
    previously it would throw an exception due to attempting to stringify
    non-string values.
  • With this entire patch stack (/r/10695, /r/10696, and /r/10697),
    rbt post is able to create review requests with commit history.

Diff Revision 4

This is not the most recent revision of the diff. The latest diff is revision 5. See what's changed.

orig
1
2
3
4
5

Commits

First Last Summary ID Author
Encode non-string query parameters as strings
There are a few cases where we are passing non-string arguments to methods that make API calls, which was fine in the past. However, we are now assuming that all arguments are strings and erroring out if they are not. Instead, we now make a best-case attempt to serialize values to strings and produces a better error message when this process fails. Testing done: Confirmed the following hold on Python verisons 2.7, 3.5, 3.6, and 3.7: - With this patch applied, `rbt status` prints the list of status, where previously it would throw an exception due to attempting to stringify non-string values. - With this entire patch stack (/r/10695, /r/10696, and /r/10697), `rbt post` is able to create review requests with commit history.
295e320552c17e18388150b902fb9861a9e22f1d Barret Rennie
rbtools/api/request.py
rbtools/api/tests.py
Loading...