SF bug #902037: relative on-disk SYSTEM id handling is incorrect

(Contributed by Bob Ippolito.)

backport candidate.
This commit is contained in:
Raymond Hettinger 2004-10-20 08:21:19 +00:00
parent e54e726f0b
commit 06d9b1f30b
1 changed files with 5 additions and 4 deletions

View File

@ -283,10 +283,11 @@ def prepare_input_source(source, base = ""):
if source.getByteStream() is None: if source.getByteStream() is None:
sysid = source.getSystemId() sysid = source.getSystemId()
if os.path.isfile(sysid):
basehead = os.path.split(os.path.normpath(base))[0] basehead = os.path.split(os.path.normpath(base))[0]
source.setSystemId(os.path.join(basehead, sysid)) sysidfilename = os.path.join(basehead, sysid)
f = open(sysid, "rb") if os.path.isfile(sysidfilename):
source.setSystemId(sysidfilename)
f = open(sysidfilename, "rb")
else: else:
source.setSystemId(urlparse.urljoin(base, sysid)) source.setSystemId(urlparse.urljoin(base, sysid))
f = urllib.urlopen(source.getSystemId()) f = urllib.urlopen(source.getSystemId())