Fix up some unicode vs. bytes issues in rbtools.api

Review Request #9535 — Created Jan. 25, 2018 and submitted

Information

RBTools
master
b6b6e77...

Reviewers

There are a handful of places that were using the wrong data type within
the API wrappers in RBTools. This worked fine in Python 2 because
they're freely convertable, but would crash or otherwise fail under
Python 3. This change fixes those up.

Ran unit tests under Python 2.7 and 3.6.

Description From Last Updated

The proper casing is what we had before. Why this change?

chipx86chipx86

Might as well combine these. Doesn't look like we're re-using the request after this.

chipx86chipx86
chipx86
  1. 
      
  2. rbtools/api/cache.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    The proper casing is what we had before. Why this change?

    1. Python 3's urllib.request.Request is calling key.capitalize() to normalize the header names to prevent conflicts (https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L409). Unfortunately they don't do the same in has_header or get_header.

      All HTTP headers are case insensitive anyway so while it's annoying it's not really "incorrect"

    2. Ah okay, so it's a weird Python thing. Fine then.

  3. rbtools/api/request.py (Diff revision 1)
     
     
     
     
    Show all issues

    Might as well combine these. Doesn't look like we're re-using the request after this.

  4. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to master (ce1e422)