OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 | 8 |
9 HTTP server for our HTML rebaseline viewer. | 9 HTTP server for our HTML rebaseline viewer. |
10 """ | 10 """ |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 GET__STATIC_CONTENTS, GENERATED_HTML_SUBDIR)) | 468 GET__STATIC_CONTENTS, GENERATED_HTML_SUBDIR)) |
469 return | 469 return |
470 if self.path == '/favicon.ico' : | 470 if self.path == '/favicon.ico' : |
471 self.redirect_to('/%s/favicon.ico' % GET__STATIC_CONTENTS) | 471 self.redirect_to('/%s/favicon.ico' % GET__STATIC_CONTENTS) |
472 return | 472 return |
473 | 473 |
474 # All requests must be of this form: | 474 # All requests must be of this form: |
475 # /dispatcher/remainder | 475 # /dispatcher/remainder |
476 # where 'dispatcher' indicates which do_GET_* dispatcher to run | 476 # where 'dispatcher' indicates which do_GET_* dispatcher to run |
477 # and 'remainder' is the remaining path sent to that dispatcher. | 477 # and 'remainder' is the remaining path sent to that dispatcher. |
478 normpath = posixpath.normpath(self.path) | 478 (dispatcher_name, remainder) = PATHSPLIT_RE.match(self.path).groups() |
479 (dispatcher_name, remainder) = PATHSPLIT_RE.match(normpath).groups() | |
480 dispatchers = { | 479 dispatchers = { |
481 GET__LIVE_RESULTS: self.do_GET_live_results, | 480 GET__LIVE_RESULTS: self.do_GET_live_results, |
482 GET__PRECOMPUTED_RESULTS: self.do_GET_precomputed_results, | 481 GET__PRECOMPUTED_RESULTS: self.do_GET_precomputed_results, |
483 GET__PREFETCH_RESULTS: self.do_GET_prefetch_results, | 482 GET__PREFETCH_RESULTS: self.do_GET_prefetch_results, |
484 GET__STATIC_CONTENTS: self.do_GET_static, | 483 GET__STATIC_CONTENTS: self.do_GET_static, |
485 } | 484 } |
486 dispatcher = dispatchers[dispatcher_name] | 485 dispatcher = dispatchers[dispatcher_name] |
487 dispatcher(remainder) | 486 dispatcher(remainder) |
488 except: | 487 except: |
489 self.send_error(404) | 488 self.send_error(404) |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 reload_seconds=args.reload, config_pairs=config_pairs, | 819 reload_seconds=args.reload, config_pairs=config_pairs, |
821 builder_regex_list=args.builders, boto_file_path=args.boto, | 820 builder_regex_list=args.builders, boto_file_path=args.boto, |
822 imagediffdb_threads=args.threads) | 821 imagediffdb_threads=args.threads) |
823 if args.truncate: | 822 if args.truncate: |
824 _SERVER.truncate_results = True | 823 _SERVER.truncate_results = True |
825 _SERVER.run() | 824 _SERVER.run() |
826 | 825 |
827 | 826 |
828 if __name__ == '__main__': | 827 if __name__ == '__main__': |
829 main() | 828 main() |
OLD | NEW |