[Python-checkins] r61105 - python/trunk/Lib/SimpleHTTPServer.py
andrew.kuchling
python-checkins at python.org
Thu Feb 28 15:03:04 CET 2008
Author: andrew.kuchling
Date: Thu Feb 28 15:03:03 2008
New Revision: 61105
Modified:
python/trunk/Lib/SimpleHTTPServer.py
Log:
#2169: make generated HTML more valid
Modified: python/trunk/Lib/SimpleHTTPServer.py
==============================================================================
--- python/trunk/Lib/SimpleHTTPServer.py (original)
+++ python/trunk/Lib/SimpleHTTPServer.py Thu Feb 28 15:03:03 2008
@@ -112,8 +112,9 @@
list.sort(key=lambda a: a.lower())
f = StringIO()
displaypath = cgi.escape(urllib.unquote(self.path))
- f.write("<title>Directory listing for %s</title>\n" % displaypath)
- f.write("<h2>Directory listing for %s</h2>\n" % displaypath)
+ f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')
+ f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath)
+ f.write("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath)
f.write("<hr>\n<ul>\n")
for name in list:
fullname = os.path.join(path, name)
@@ -127,7 +128,7 @@
# Note: a link to a directory displays with @ and links with /
f.write('<li><a href="%s">%s</a>\n'
% (urllib.quote(linkname), cgi.escape(displayname)))
- f.write("</ul>\n<hr>\n")
+ f.write("</ul>\n<hr>\n</body>\n</html>\n")
length = f.tell()
f.seek(0)
self.send_response(200)
More information about the Python-checkins
mailing list