180
179
transport_list_registry.remove(scheme)
184
@deprecated_function(zero_ninety)
186
# TODO: jam 20060606 urls should only be ascii, or they should raise InvalidURL
187
if isinstance(url, unicode):
188
url = url.encode('utf-8')
189
(scheme, netloc, path, params,
190
query, fragment) = urlparse.urlparse(url, allow_fragments=False)
191
username = password = host = port = None
193
username, host = netloc.split('@', 1)
195
username, password = username.split(':', 1)
196
password = urllib.unquote(password)
197
username = urllib.unquote(username)
202
host, port = host.rsplit(':', 1)
206
# TODO: Should this be ConnectionError?
207
raise errors.TransportError(
208
'invalid port number %s in url:\n%s' % (port, url))
209
host = urllib.unquote(host)
211
path = urllib.unquote(path)
213
return (scheme, username, password, host, port, path)
216
182
class _CoalescedOffset(object):
217
183
"""A data container for keeping track of coalesced offsets."""
1540
1506
return transport
1543
@deprecated_function(zero_ninety)
1544
def urlescape(relpath):
1545
urlutils.escape(relpath)
1548
@deprecated_function(zero_ninety)
1549
def urlunescape(url):
1550
urlutils.unescape(url)
1552
1509
# We try to recognize an url lazily (ignoring user, password, etc)
1553
1510
_urlRE = re.compile(r'^(?P<proto>[^:/\\]+)://(?P<rest>.*)$')