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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 """ Handle a GET request for live-generated image diff data. | 590 """ Handle a GET request for live-generated image diff data. |
591 | 591 |
592 Args: | 592 Args: |
593 url_remainder: string indicating which image diffs to generate | 593 url_remainder: string indicating which image diffs to generate |
594 prefetch_only: if True, the user isn't waiting around for results | 594 prefetch_only: if True, the user isn't waiting around for results |
595 """ | 595 """ |
596 param_dict = urlparse.parse_qs(url_remainder) | 596 param_dict = urlparse.parse_qs(url_remainder) |
597 download_all_images = ( | 597 download_all_images = ( |
598 param_dict.get(LIVE_PARAM__DOWNLOAD_ONLY_DIFFERING, [''])[0].lower() | 598 param_dict.get(LIVE_PARAM__DOWNLOAD_ONLY_DIFFERING, [''])[0].lower() |
599 not in ['1', 'true']) | 599 not in ['1', 'true']) |
600 setA_dirs = param_dict[LIVE_PARAM__SET_A_DIR] | 600 setA_dir = param_dict[LIVE_PARAM__SET_A_DIR][0] |
601 setB_dirs = param_dict[LIVE_PARAM__SET_B_DIR] | 601 setB_dir = param_dict[LIVE_PARAM__SET_B_DIR][0] |
602 setA_section = self._validate_summary_section( | 602 setA_section = self._validate_summary_section( |
603 param_dict.get(LIVE_PARAM__SET_A_SECTION, [None])[0]) | 603 param_dict.get(LIVE_PARAM__SET_A_SECTION, [None])[0]) |
604 setB_section = self._validate_summary_section( | 604 setB_section = self._validate_summary_section( |
605 param_dict.get(LIVE_PARAM__SET_B_SECTION, [None])[0]) | 605 param_dict.get(LIVE_PARAM__SET_B_SECTION, [None])[0]) |
606 | 606 |
607 # If the sets show expectations vs actuals, always show expectations on | 607 # If the sets show expectations vs actuals, always show expectations on |
608 # the left (setA). | 608 # the left (setA). |
609 if ((setA_section == gm_json.JSONKEY_ACTUALRESULTS) and | 609 if ((setA_section == gm_json.JSONKEY_ACTUALRESULTS) and |
610 (setB_section == gm_json.JSONKEY_EXPECTEDRESULTS)): | 610 (setB_section == gm_json.JSONKEY_EXPECTEDRESULTS)): |
611 setA_dirs, setB_dirs = setB_dirs, setA_dirs | 611 setA_dir, setB_dir = setB_dir, setA_dir |
612 setA_section, setB_section = setB_section, setA_section | 612 setA_section, setB_section = setB_section, setA_section |
613 | 613 |
614 # Are we comparing some actuals against expectations stored in the repo? | 614 # Are we comparing some actuals against expectations stored in the repo? |
615 # If so, we can allow the user to submit new baselines. | 615 # If so, we can allow the user to submit new baselines. |
616 is_editable = ( | 616 is_editable = ( |
617 (setA_section == gm_json.JSONKEY_EXPECTEDRESULTS) and | 617 (setA_section == gm_json.JSONKEY_EXPECTEDRESULTS) and |
618 (setA_dirs[0].startswith(compare_rendered_pictures.REPO_URL_PREFIX)) and | 618 (setA_dir.startswith(compare_rendered_pictures.REPO_URL_PREFIX)) and |
619 (setB_section == gm_json.JSONKEY_ACTUALRESULTS)) | 619 (setB_section == gm_json.JSONKEY_ACTUALRESULTS)) |
620 | 620 |
621 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( | 621 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( |
622 setA_dirs=setA_dirs, setB_dirs=setB_dirs, | 622 setA_dir=setA_dir, setB_dir=setB_dir, |
623 setA_section=setA_section, setB_section=setB_section, | 623 setA_section=setA_section, setB_section=setB_section, |
624 image_diff_db=_SERVER.image_diff_db, | 624 image_diff_db=_SERVER.image_diff_db, |
625 diff_base_url='/static/generated-images', | 625 diff_base_url='/static/generated-images', |
626 gs=_SERVER.gs, truncate_results=_SERVER.truncate_results, | 626 gs=_SERVER.gs, truncate_results=_SERVER.truncate_results, |
627 prefetch_only=prefetch_only, download_all_images=download_all_images) | 627 prefetch_only=prefetch_only, download_all_images=download_all_images) |
628 if prefetch_only: | 628 if prefetch_only: |
629 self.send_response(200) | 629 self.send_response(200) |
630 else: | 630 else: |
631 self.send_json_dict(results_obj.get_packaged_results_of_type( | 631 self.send_json_dict(results_obj.get_packaged_results_of_type( |
632 results_type=results_mod.KEY__HEADER__RESULTS_ALL, | 632 results_type=results_mod.KEY__HEADER__RESULTS_ALL, |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 reload_seconds=args.reload, config_pairs=config_pairs, | 898 reload_seconds=args.reload, config_pairs=config_pairs, |
899 builder_regex_list=args.builders, boto_file_path=args.boto, | 899 builder_regex_list=args.builders, boto_file_path=args.boto, |
900 imagediffdb_threads=args.threads) | 900 imagediffdb_threads=args.threads) |
901 if args.truncate: | 901 if args.truncate: |
902 _SERVER.truncate_results = True | 902 _SERVER.truncate_results = True |
903 _SERVER.run() | 903 _SERVER.run() |
904 | 904 |
905 | 905 |
906 if __name__ == '__main__': | 906 if __name__ == '__main__': |
907 main() | 907 main() |
OLD | NEW |