[Python-checkins] CVS: python/dist/src/Lib nturl2path.py,1.8,1.9
Eric S. Raymond
esr@users.sourceforge.net
Fri, 09 Feb 2001 03:02:22 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv12116
Modified Files:
nturl2path.py
Log Message:
String method conversion.
Index: nturl2path.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/nturl2path.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** nturl2path.py 2001/02/06 01:07:01 1.8
--- nturl2path.py 2001/02/09 11:02:20 1.9
***************
*** 20,32 ****
# (notice halving of slashes at the start of the path)
url = url[2:]
! components = string.split(url, '/')
# make sure not to convert quoted slashes :-)
! return urllib.unquote(string.join(components, '\\'))
! comp = string.split(url, '|')
if len(comp) != 2 or comp[0][-1] not in string.letters:
error = 'Bad URL: ' + url
raise IOError, error
! drive = string.upper(comp[0][-1])
! components = string.split(comp[1], '/')
path = drive + ':'
for comp in components:
--- 20,32 ----
# (notice halving of slashes at the start of the path)
url = url[2:]
! components = url.split('/')
# make sure not to convert quoted slashes :-)
! return urllib.unquote('\\'.join(components))
! comp = url.split('|')
if len(comp) != 2 or comp[0][-1] not in string.letters:
error = 'Bad URL: ' + url
raise IOError, error
! drive = comp[0][-1].upper()
! components = comp[1].split('/')
path = drive + ':'
for comp in components:
***************
*** 53,65 ****
# (notice doubling of slashes at the start of the path)
p = '\\\\' + p
! components = string.split(p, '\\')
! return urllib.quote(string.join(components, '/'))
! comp = string.split(p, ':')
if len(comp) != 2 or len(comp[0]) > 1:
error = 'Bad path: ' + p
raise IOError, error
! drive = urllib.quote(string.upper(comp[0]))
! components = string.split(comp[1], '\\')
path = '///' + drive + '|'
for comp in components:
--- 53,65 ----
# (notice doubling of slashes at the start of the path)
p = '\\\\' + p
! components = p.split('\\')
! return urllib.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())
! components = comp[1].split('\\')
path = '///' + drive + '|'
for comp in components: