Commit 0bc90c46 authored by Guido van Rossum's avatar Guido van Rossum

Some changes (maybe not enough?) to make it work on Windows with local

file URLs.
parent 1ccb9bb4
...@@ -606,9 +606,9 @@ class MyURLopener(urllib.FancyURLopener): ...@@ -606,9 +606,9 @@ class MyURLopener(urllib.FancyURLopener):
def open_file(self, url): def open_file(self, url):
path = urllib.url2pathname(urllib.unquote(url)) path = urllib.url2pathname(urllib.unquote(url))
if os.path.isdir(path):
if path[-1] != os.sep: if path[-1] != os.sep:
url = url + '/' url = url + '/'
if os.path.isdir(path):
indexpath = os.path.join(path, "index.html") indexpath = os.path.join(path, "index.html")
if os.path.exists(indexpath): if os.path.exists(indexpath):
return self.open_file(url + "index.html") return self.open_file(url + "index.html")
...@@ -625,7 +625,7 @@ class MyURLopener(urllib.FancyURLopener): ...@@ -625,7 +625,7 @@ class MyURLopener(urllib.FancyURLopener):
s.write('<A HREF="%s">%s</A>\n' % (q, q)) s.write('<A HREF="%s">%s</A>\n' % (q, q))
s.seek(0) s.seek(0)
return s return s
return urllib.FancyURLopener.open_file(self, path) return urllib.FancyURLopener.open_file(self, url)
class MyHTMLParser(sgmllib.SGMLParser): class MyHTMLParser(sgmllib.SGMLParser):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment