Ticket #7831: urlpath-python3.patch

File urlpath-python3.patch, 2.1 KB (added by _sunu_, 6 years ago)
  • twisted/python/dist3.py

    diff --git twisted/python/dist3.py twisted/python/dist3.py
    index 3092ccd..4b31291 100644
    modules = [ 
    122122    "twisted.python.test.modules_helpers",
    123123    "twisted.python.threadable",
    124124    "twisted.python.threadpool",
     125    "twisted.python.urlpath",
    125126    "twisted.python.usage",
    126127    "twisted.python.util",
    127128    "twisted.python.versions",
    testModules = [ 
    211212    "twisted.python.test.test_runtime",
    212213    "twisted.python.test.test_systemd",
    213214    "twisted.python.test.test_tzhelper",
     215    "twisted.python.test.test_urlpath",
    214216    "twisted.python.test.test_util",
    215217    "twisted.python.test.test_versions",
    216218    "twisted.test.testutils",
  • twisted/python/urlpath.py

    diff --git twisted/python/urlpath.py twisted/python/urlpath.py
    index 1c15f09..cc3b971 100644
     
    44
    55#
    66
    7 import urlparse
    8 import urllib
     7from __future__ import division, absolute_import
     8
     9from twisted.python.compat import _PY3
     10if not _PY3:
     11    import urlparse
     12    from urllib import unquote as unquoteFunc
     13else:
     14    import urllib.parse as urlparse
     15    from urllib.parse import unquote as unquoteFunc
     16
    917
    1018class URLPath:
    1119    def __init__(self, scheme='', netloc='localhost', path='',
    class URLPath: 
    1826
    1927    _qpathlist = None
    2028    _uqpathlist = None
    21    
     29
    2230    def pathList(self, unquote=0, copy=1):
    2331        if self._qpathlist is None:
    2432            self._qpathlist = self.path.split('/')
    25             self._uqpathlist = map(urllib.unquote, self._qpathlist)
     33            self._uqpathlist = map(unquoteFunc, self._qpathlist)
    2634        if unquote:
    2735            result = self._uqpathlist
    2836        else:
    class URLPath: 
    101109                l = self.pathList()
    102110                l[-1] = path
    103111                path = '/'.join(l)
    104        
     112
    105113        return URLPath(scheme,
    106114                        netloc,
    107115                        path,
    class URLPath: 
    109117                        fragment)
    110118
    111119
    112    
     120
    113121    def __str__(self):
    114122        x = urlparse.urlunsplit((
    115123            self.scheme, self.netloc, self.path,