| OLD | NEW |
| 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # | 6 # |
| 7 # 1. Redistributions of source code must retain the above | 7 # 1. Redistributions of source code must retain the above |
| 8 # copyright notice, this list of conditions and the following | 8 # copyright notice, this list of conditions and the following |
| 9 # disclaimer. | 9 # disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above | 10 # 2. Redistributions in binary form must reproduce the above |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if self.filesystem.isfile(filename): | 50 if self.filesystem.isfile(filename): |
| 51 try: | 51 try: |
| 52 doc = BeautifulSoup(self.filesystem.read_binary_file(filename)) | 52 doc = BeautifulSoup(self.filesystem.read_binary_file(filename)) |
| 53 except IOError: | 53 except IOError: |
| 54 _log.error("IOError: Failed to read %s", filename) | 54 _log.error("IOError: Failed to read %s", filename) |
| 55 doc = None | 55 doc = None |
| 56 except HTMLParser.HTMLParseError: | 56 except HTMLParser.HTMLParseError: |
| 57 # FIXME: Figure out what to do if we can't parse the file. | 57 # FIXME: Figure out what to do if we can't parse the file. |
| 58 _log.error("HTMLParseError: Failed to parse %s", filename) | 58 _log.error("HTMLParseError: Failed to parse %s", filename) |
| 59 doc = None | 59 doc = None |
| 60 except UnicodeEncodeError: |
| 61 _log.error("UnicodeEncodeError while reading %s", filename) |
| 62 doc = None |
| 60 else: | 63 else: |
| 61 if self.filesystem.isdir(filename): | 64 if self.filesystem.isdir(filename): |
| 62 # FIXME: Figure out what is triggering this and what to do about
it. | 65 # FIXME: Figure out what is triggering this and what to do about
it. |
| 63 _log.error("Trying to load %s, which is a directory", filename) | 66 _log.error("Trying to load %s, which is a directory", filename) |
| 64 doc = None | 67 doc = None |
| 65 | 68 |
| 66 if is_ref: | 69 if is_ref: |
| 67 self.ref_doc = doc | 70 self.ref_doc = doc |
| 68 else: | 71 else: |
| 69 self.test_doc = doc | 72 self.test_doc = doc |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 href_paths = [href_tag['href'] for href_tag in elements_with_href_attrib
utes] | 165 href_paths = [href_tag['href'] for href_tag in elements_with_href_attrib
utes] |
| 163 | 166 |
| 164 paths = src_paths + href_paths + urls | 167 paths = src_paths + href_paths + urls |
| 165 for path in paths: | 168 for path in paths: |
| 166 if not path.startswith('http:') and not path.startswith('mailto:'): | 169 if not path.startswith('http:') and not path.startswith('mailto:'): |
| 167 uri_scheme_pattern = re.compile(r'[A-Za-z][A-Za-z+.-]*:') | 170 uri_scheme_pattern = re.compile(r'[A-Za-z][A-Za-z+.-]*:') |
| 168 if not uri_scheme_pattern.match(path): | 171 if not uri_scheme_pattern.match(path): |
| 169 support_files.append(path) | 172 support_files.append(path) |
| 170 | 173 |
| 171 return support_files | 174 return support_files |
| OLD | NEW |