summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-10-20 08:21:19 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-10-20 08:21:19 (GMT)
commit06d9b1f30bfaa24614a20047ea3ae0b6328177d8 (patch)
treedfc54871bb05afd9b2f69f94455c013c008abb95 /Lib/xml
parente54e726f0bce70d2999b8e79afe5d336b0bcfed3 (diff)
downloadcpython-06d9b1f30bfaa24614a20047ea3ae0b6328177d8.zip
cpython-06d9b1f30bfaa24614a20047ea3ae0b6328177d8.tar.gz
cpython-06d9b1f30bfaa24614a20047ea3ae0b6328177d8.tar.bz2
SF bug #902037: relative on-disk SYSTEM id handling is incorrect
(Contributed by Bob Ippolito.) backport candidate.
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/sax/saxutils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py
index 3402a02..631159b 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())