Index: cfe/trunk/tools/scan-view/share/ScanView.py =================================================================== --- cfe/trunk/tools/scan-view/share/ScanView.py +++ cfe/trunk/tools/scan-view/share/ScanView.py @@ -1,5 +1,8 @@ -import BaseHTTPServer -import SimpleHTTPServer +try: + from http.server import HTTPServer, SimpleHTTPRequestHandler +except ImportError: + from BaseHTTPServer import HTTPServer + from SimpleHTTPServer import SimpleHTTPRequestHandler import os import sys import urllib, urlparse @@ -112,9 +115,9 @@ print >>s,'' self.status = s.getvalue() -class ScanViewServer(BaseHTTPServer.HTTPServer): +class ScanViewServer(HTTPServer): def __init__(self, address, handler, root, reporters, options): - BaseHTTPServer.HTTPServer.__init__(self, address, handler) + HTTPServer.__init__(self, address, handler) self.root = root self.reporters = reporters self.options = options @@ -170,7 +173,7 @@ if self.options.autoReload: import ScanView self.RequestHandlerClass = reload(ScanView).ScanViewRequestHandler - BaseHTTPServer.HTTPServer.finish_request(self, request, client_address) + HTTPServer.finish_request(self, request, client_address) def handle_error(self, request, client_address): # Ignore socket errors @@ -179,7 +182,7 @@ if self.options.debug > 1: print >>sys.stderr, "%s: SERVER: ignored socket error." % (sys.argv[0],) return - BaseHTTPServer.HTTPServer.handle_error(self, request, client_address) + HTTPServer.handle_error(self, request, client_address) # Borrowed from Quixote, with simplifications. def parse_query(qs, fields=None): @@ -200,19 +203,19 @@ item.append(value) return fields -class ScanViewRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): +class ScanViewRequestHandler(SimpleHTTPRequestHandler): server_version = "ScanViewServer/" + __version__ dynamic_mtime = time.time() def do_HEAD(self): try: - SimpleHTTPServer.SimpleHTTPRequestHandler.do_HEAD(self) + SimpleHTTPRequestHandler.do_HEAD(self) except Exception as e: self.handle_exception(e) def do_GET(self): try: - SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) + SimpleHTTPRequestHandler.do_GET(self) except Exception as e: self.handle_exception(e)