]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix some cases where self.openedurl wasn't set.
authorGuido van Rossum <guido@python.org>
Thu, 10 Oct 1996 16:01:16 +0000 (16:01 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 10 Oct 1996 16:01:16 +0000 (16:01 +0000)
Lib/urllib.py

index 7b5ed6b3594402d6fb2100494f8cb34d6a663fa3..418650253b816e35460b128347b81b32e3857d93 100644 (file)
@@ -254,12 +254,13 @@ class URLopener:
        # Use local file
        def open_local_file(self, url):
                host, file = splithost(url)
-               if not host: return addinfourl(open(url2pathname(file), 'r'), noheaders(), self.openedurl)
+               if not host:
+                       return addinfourl(open(url2pathname(file), 'r'), noheaders(), 'file:'+file)
                host, port = splitport(host)
                if not port and socket.gethostbyname(host) in (
                          localhost(), thishost()):
                        file = unquote(file)
-                       return addinfourl(open(url2pathname(file), 'r'), noheaders(), self.openedurl)
+                       return addinfourl(open(url2pathname(file), 'r'), noheaders(), 'file:'+file)
                raise IOError, ('local file error', 'not on local host')
 
        # Use FTP protocol