Use the more modern six library to handle urllib, cStringIO, and cPickle.

Review Request #4936 — Created Nov. 11, 2013 and submitted

david
Review Board
master
reviewboard

Use the more modern six library to handle urllib, cStringIO, and cPickle.

The urlparse, urllib, and urllib2 modules have been significantly reworked in
Python 3 to provide a much more consistent interface.

Additionally, the 'fast' versions of StringIO and pickle are now merged with
the 'slow' versions, so in the future we'll be able to just use io.StringIO and
pickle without the fallbacks.

'six' has some adaptations to help with this for the time being. It's not as
pretty as I would like, but it works. The ugliest part of this is for places
where we override netloc\_uses, which isn't among the "moved attributes" in six.

Ran unit tests.

Description From Last Updated

compat should be after cache.

chipx86chipx86

error before parse.

chipx86chipx86

error before parse.

chipx86chipx86

util after siteconfig.

chipx86chipx86

Mind documenting why we're doing this? Think I'd also prefer we pull out uses_netloc from the appropriate module, and then …

chipx86chipx86

Same comment here about docs and extending once. Actually, given that we're doing this multiple times, I think a better …

chipx86chipx86

Same here.

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/admin/forms.py (Diff revision 1)
     
     
     
     

    compat should be after cache.

  3. reviewboard/hostingsvcs/beanstalk.py (Diff revision 1)
     
     
     

    error before parse.

  4. reviewboard/hostingsvcs/bitbucket.py (Diff revision 1)
     
     
     

    error before parse.

  5. reviewboard/hostingsvcs/github.py (Diff revision 1)
     
     
     
     

    util after siteconfig.

  6. reviewboard/scmtools/bzr.py (Diff revision 1)
     
     
     
     
     
     
     

    Mind documenting why we're doing this?

    Think I'd also prefer we pull out uses_netloc from the appropriate module, and then extend it only once.

  7. reviewboard/scmtools/git.py (Diff revision 1)
     
     
     
     
     
     
     
     
     

    Same comment here about docs and extending once.

    Actually, given that we're doing this multiple times, I think a better option is to have a utility function that wraps this logic for us that we can just reuse.

  8. reviewboard/ssh/utils.py (Diff revision 1)
     
     
     
     
     
     
     
     
     

    Same here.

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

Status: Closed (submitted)

Change Summary:

Pushed to master (b9d9573)
Loading...