Abstract away some types

Review Request #4906 — Created Nov. 5, 2013 and submitted

david
Djblets
master
djblets

Abstract away some types

String and integer types have changed in python 3. In 2.x, the str type is a
string of bytes, and the unicode type is a string of text. In 3.x, the
bytes type has replaced the old str, and str has replaced unicode. The
six library has abstractions for these that we can use while we're trying to
support both.

Additionally, 3.x has merged the int and long types, so there's a similar
abstraction for that.

Ran unit tests.

Description From Last Updated

Do we really need it in this case? Wouldn't str() do the right thing in either case here when we're ...

chipx86chipx86
chipx86
  1. 
      
  2. djblets/util/templatetags/djblets_js.py (Diff revision 1)
     
     

    Do we really need it in this case? Wouldn't str() do the right thing in either case here when we're using string formatters?

    I thought text_type was more useful when doing isinstance and such.

    I admit ignorance in a lot of this.

    1. Given that we were explicitly casting to unicode, I think I'd rather use the six type. It's str in python 3 and unicode in python 2, which duplicates what we were doing here already.

  3. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Loading...