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 import third_party.json_schema_compiler.json_comment_eater as json_comment_eater | 10 import third_party.json_schema_compiler.json_comment_eater as json_comment_eater |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 def get(self, key): | 84 def get(self, key): |
85 path, ext = os.path.splitext(key) | 85 path, ext = os.path.splitext(key) |
86 unix_name = model.UnixName(path) | 86 unix_name = model.UnixName(path) |
87 json_path = unix_name + '.json' | 87 json_path = unix_name + '.json' |
88 idl_path = unix_name + '.idl' | 88 idl_path = unix_name + '.idl' |
89 try: | 89 try: |
90 return self._GenerateHandlebarContext(key, | 90 return self._GenerateHandlebarContext(key, |
91 self._json_cache.GetFromFile(self._base_path + '/' + json_path), | 91 self._json_cache.GetFromFile(self._base_path + '/' + json_path), |
92 path) | 92 path) |
93 except OSError: | 93 except IOError: |
94 try: | 94 try: |
95 return self._GenerateHandlebarContext(key, | 95 return self._GenerateHandlebarContext(key, |
96 self._idl_cache.GetFromFile(self._base_path + '/' + idl_path), | 96 self._idl_cache.GetFromFile(self._base_path + '/' + idl_path), |
97 path) | 97 path) |
98 except OSError as e: | 98 except IOError as e: |
99 raise | 99 raise |
OLD | NEW |