From: Raymond Hettinger Date: Wed, 20 Oct 2004 08:21:19 +0000 (+0000) Subject: SF bug #902037: relative on-disk SYSTEM id handling is incorrect X-Git-Tag: v2.4b2~77 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06d9b1f30bfaa24614a20047ea3ae0b6328177d8;p=python SF bug #902037: relative on-disk SYSTEM id handling is incorrect (Contributed by Bob Ippolito.) backport candidate. --- diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py index 3402a02dad..631159b759 100644 --- a/Lib/xml/sax/saxutils.py +++ b/Lib/xml/sax/saxutils.py @@ -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())