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

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

David Trowbridge
RBTools
master
b6b6e77...
rbtools

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.

  • 0
  • 0
  • 1
  • 1
  • 2
Description From Last Updated
Christian Hammond
  1. 
      
  2. rbtools/api/cache.py (Diff revision 1)
     
     
     
     
     

    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)
     
     
     
     

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

  4. 
      
David Trowbridge
Christian Hammond
  1. Ship It!
  2. 
      
David Trowbridge
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (ce1e422)
Loading...