Properly decode API errors from UTF-8
Review Request #10697 — Created Sept. 6, 2019 and submitted — Latest diff uploaded
When we received an error message from the Review Board API, if we
didn't have a pre-generated string for that error code locally we would
include the error body verbatim. We did this by attempting to cast it to
a string and encode it to utf-8, but that only works on Python 2 where
str is actually bytes. On Python 3, an error is raised becuase you are
not allowed to decode a bytes object into text without a codec.Instead, we now return text from the API errors when calling
str(e)
on
them, instead of returning their body verbatim.While I was here, I also removed a bunch of unnecessary unicode
literals. We are usingunicode_literals
everywhere so they were
redundant.
Diff Revision 1
This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.
Commits
rbtools/api/errors.py |
---|
rbtools/commands/post.py |
---|