OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 from handlebar_dict_generator import HandlebarDictGenerator | 9 from handlebar_dict_generator import HandlebarDictGenerator |
10 from handlebar_dict_generator import NoDocError | |
10 import third_party.json_schema_compiler.json_comment_eater as json_comment_eater | 11 import third_party.json_schema_compiler.json_comment_eater as json_comment_eater |
11 import third_party.json_schema_compiler.model as model | 12 import third_party.json_schema_compiler.model as model |
12 import third_party.json_schema_compiler.idl_schema as idl_schema | 13 import third_party.json_schema_compiler.idl_schema as idl_schema |
13 import third_party.json_schema_compiler.idl_parser as idl_parser | 14 import third_party.json_schema_compiler.idl_parser as idl_parser |
14 | 15 |
15 class APIDataSource(object): | 16 class APIDataSource(object): |
16 """This class fetches and loads JSON APIs from the FileSystem passed in with | 17 """This class fetches and loads JSON APIs from the FileSystem passed in with |
17 |cache_builder|, so the APIs can be plugged into templates. | 18 |cache_builder|, so the APIs can be plugged into templates. |
18 """ | 19 """ |
19 class Factory(object): | 20 class Factory(object): |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 | 84 |
84 def get(self, key): | 85 def get(self, key): |
85 path, ext = os.path.splitext(key) | 86 path, ext = os.path.splitext(key) |
86 unix_name = model.UnixName(path) | 87 unix_name = model.UnixName(path) |
87 json_path = unix_name + '.json' | 88 json_path = unix_name + '.json' |
88 idl_path = unix_name + '.idl' | 89 idl_path = unix_name + '.idl' |
89 try: | 90 try: |
90 return self._GenerateHandlebarContext(key, | 91 return self._GenerateHandlebarContext(key, |
91 self._json_cache.GetFromFile(self._base_path + '/' + json_path), | 92 self._json_cache.GetFromFile(self._base_path + '/' + json_path), |
92 path) | 93 path) |
93 except OSError: | 94 except NoDocError: |
95 raise | |
96 except Exception: | |
not at google - send to devlin
2012/08/09 05:11:36
why did you change these from OSError to Exception
cduvall
2012/08/09 17:54:05
Yeah, I agree that the FileSystems should all beha
| |
94 try: | 97 try: |
95 return self._GenerateHandlebarContext(key, | 98 return self._GenerateHandlebarContext(key, |
96 self._idl_cache.GetFromFile(self._base_path + '/' + idl_path), | 99 self._idl_cache.GetFromFile(self._base_path + '/' + idl_path), |
97 path) | 100 path) |
98 except OSError as e: | 101 except Exception as e: |
99 raise | 102 raise |
OLD | NEW |