[Python-checkins] CVS: python/dist/src/Lib macurl2path.py,1.10,1.11
Eric S. Raymond
esr@users.sourceforge.net
Fri, 09 Feb 2001 01:48:47 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv1178
Modified Files:
macurl2path.py
Log Message:
String method conversion.
Index: macurl2path.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/macurl2path.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** macurl2path.py 2001/01/24 06:27:27 1.10
--- macurl2path.py 2001/02/09 09:48:45 1.11
***************
*** 3,7 ****
Do not import directly; use urllib instead."""
- import string
import urllib
import os
--- 3,6 ----
***************
*** 22,26 ****
elif pathname[:2] == '//':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
! components = string.split(pathname, '/')
# Remove . and embedded ..
i = 0
--- 21,25 ----
elif pathname[:2] == '//':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
! components = pathname.split('/')
# Remove . and embedded ..
i = 0
***************
*** 38,42 ****
if not components[0]:
# Absolute unix path, don't start with colon
! rv = string.join(components[1:], ':')
else:
# relative unix path, start with colon. First replace
--- 37,41 ----
if not components[0]:
# Absolute unix path, don't start with colon
! rv = ':'.join(components[1:])
else:
# relative unix path, start with colon. First replace
***************
*** 46,50 ****
components[i] = ''
i = i + 1
! rv = ':' + string.join(components, ':')
# and finally unquote slashes and other funny characters
return urllib.unquote(rv)
--- 45,49 ----
components[i] = ''
i = i + 1
! rv = ':' + ':'.join(components)
# and finally unquote slashes and other funny characters
return urllib.unquote(rv)
***************
*** 54,58 ****
if '/' in pathname:
raise RuntimeError, "Cannot convert pathname containing slashes"
! components = string.split(pathname, ':')
# Remove empty first and/or last component
if components[0] == '':
--- 53,57 ----
if '/' in pathname:
raise RuntimeError, "Cannot convert pathname containing slashes"
! components = pathname.split(':')
# Remove empty first and/or last component
if components[0] == '':
***************
*** 68,74 ****
if os.path.isabs(pathname):
! return '/' + string.join(components, '/')
else:
! return string.join(components, '/')
def _pncomp2url(component):
--- 67,73 ----
if os.path.isabs(pathname):
! return '/' + '/'.join(components)
else:
! return '/'.join(components)
def _pncomp2url(component):