summaryrefslogtreecommitdiffstats
path: root/Lib/nturl2path.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-06-18 22:38:24 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-06-18 22:38:24 (GMT)
commitc80902eac8cc71c4a6eb64d65a07c78d1825a94e (patch)
treea7847311a4052f4fcb357e2a45e747df59cd439d /Lib/nturl2path.py
parentcb0d2d71983a336741a926742232cd810068e43d (diff)
downloadcpython-c80902eac8cc71c4a6eb64d65a07c78d1825a94e.zip
cpython-c80902eac8cc71c4a6eb64d65a07c78d1825a94e.tar.gz
cpython-c80902eac8cc71c4a6eb64d65a07c78d1825a94e.tar.bz2
follow-up of r64385: rename urllib.quote in nturl2path
and remove assertions & debugger when ssl is not present
Diffstat (limited to 'Lib/nturl2path.py')
-rw-r--r--Lib/nturl2path.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/nturl2path.py b/Lib/nturl2path.py
index 9dde299..1cfe827 100644
--- a/Lib/nturl2path.py
+++ b/Lib/nturl2path.py
@@ -7,7 +7,7 @@ def url2pathname(url):
# ///C|/foo/bar/spam.foo
# becomes
# C:\foo\bar\spam.foo
- import string, urllib
+ import string, urllib.parse
# Windows itself uses ":" even in URLs.
url = url.replace(':', '|')
if not '|' in url:
@@ -19,7 +19,7 @@ def url2pathname(url):
url = url[2:]
components = url.split('/')
# make sure not to convert quoted slashes :-)
- return urllib.unquote('\\'.join(components))
+ return urllib.parse.unquote('\\'.join(components))
comp = url.split('|')
if len(comp) != 2 or comp[0][-1] not in string.ascii_letters:
error = 'Bad URL: ' + url
@@ -29,7 +29,7 @@ def url2pathname(url):
path = drive + ':'
for comp in components:
if comp:
- path = path + '\\' + urllib.unquote(comp)
+ path = path + '\\' + urllib.parse.unquote(comp)
return path
def pathname2url(p):
@@ -39,7 +39,7 @@ def pathname2url(p):
# C:\foo\bar\spam.foo
# becomes
# ///C|/foo/bar/spam.foo
- import urllib
+ import urllib.parse
if not ':' in p:
# No drive specifier, just convert slashes and quote the name
if p[:2] == '\\\\':
@@ -48,16 +48,16 @@ def pathname2url(p):
# (notice doubling of slashes at the start of the path)
p = '\\\\' + p
components = p.split('\\')
- return urllib.quote('/'.join(components))
+ return urllib.parse.quote('/'.join(components))
comp = p.split(':')
if len(comp) != 2 or len(comp[0]) > 1:
error = 'Bad path: ' + p
raise IOError(error)
- drive = urllib.quote(comp[0].upper())
+ drive = urllib.parse.quote(comp[0].upper())
components = comp[1].split('\\')
path = '///' + drive + '|'
for comp in components:
if comp:
- path = path + '/' + urllib.quote(comp)
+ path = path + '/' + urllib.parse.quote(comp)
return path