]> granicus.if.org Git - python/commitdiff
SF bug #902037: relative on-disk SYSTEM id handling is incorrect
authorRaymond Hettinger <python@rcn.com>
Wed, 20 Oct 2004 08:21:19 +0000 (08:21 +0000)
committerRaymond Hettinger <python@rcn.com>
Wed, 20 Oct 2004 08:21:19 +0000 (08:21 +0000)
(Contributed by Bob Ippolito.)

backport candidate.

Lib/xml/sax/saxutils.py

index 3402a02dadcc52b45284fb5ecfe84b6f5e35a486..631159b7594f10518fa3da4e5f81716fc7d754fa 100644 (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())