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:
sysid = source.getSystemId()
if os.path.isfile(sysid):
basehead = os.path.split(os.path.normpath(base))[0]
source.setSystemId(os.path.join(basehead, sysid))
f = open(sysid, "rb")
basehead = os.path.split(os.path.normpath(base))[0]
sysidfilename = os.path.join(basehead, sysid)
if os.path.isfile(sysidfilename):
source.setSystemId(sysidfilename)
f = open(sysidfilename, "rb")
else:
source.setSystemId(urlparse.urljoin(base, sysid))
f = urllib.urlopen(source.getSystemId())