From cb028b0180b38c7d0404acb936d276ff050061c6 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 21 Sep 2008 20:34:58 +0000 Subject: [PATCH] scan-view tweaks: - Update for scan-build table change. - Add --auto-reload option (for development, avoids need to restart server). - Always send Last-Modified, with a reasonable value for dynamic content. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56409 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/scan-view/ScanView.py | 22 ++++++++++++++++++---- tools/scan-view/scan-view | 3 +++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/scan-view/ScanView.py b/tools/scan-view/ScanView.py index 41e5a51392..b9839eab45 100644 --- a/tools/scan-view/ScanView.py +++ b/tools/scan-view/ScanView.py @@ -15,10 +15,15 @@ import Reporter # Keys replaced by server. +kReportColRE = re.compile('') +kReportColRepl = '' kReportBugRE = re.compile('') kReportBugRepl = 'Report Bug' kBugKeyValueRE = re.compile('') +kReportReplacements = [(kReportColRE, kReportColRepl), + (kReportBugRE, kReportBugRepl)] + ### __version__ = "0.1" @@ -88,6 +93,12 @@ class ScanViewServer(BaseHTTPServer.HTTPServer): except OSError,e: print 'OSError',e.errno + def finish_request(self, request, client_address): + if self.options.autoReload: + import ScanView + self.RequestHandlerClass = reload(ScanView).ScanViewRequestHandler + BaseHTTPServer.HTTPServer.finish_request(self, request, client_address) + def handle_error(self, request, client_address): # Ignore socket errors info = sys.exc_info() @@ -95,7 +106,7 @@ class ScanViewServer(BaseHTTPServer.HTTPServer): if self.options.debug > 1: print >>sys.stderr, "%s: SERVER: ignored socket error." % (sys.argv[0],) return - BaseHTTPServer.HTTPServer.handle_error(request, client_address) + BaseHTTPServer.HTTPServer.handle_error(self, request, client_address) # Borrowed from Quixote, with simplifications. def parse_query(qs, fields=None): @@ -114,6 +125,7 @@ def parse_query(qs, fields=None): class ScanViewRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): server_version = "ScanViewServer/" + __version__ + dynamic_mtime = time.time() def do_HEAD(self): try: @@ -382,8 +394,9 @@ Method: