Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/common/extensions/docs/server2/api_data_source.py

Issue 10808065: Extensions Docs Server: TDS fix, no local caching (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/appengine_url_fetcher.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 os 7 import os
7 8
8 from handlebar_dict_generator import HandlebarDictGenerator 9 from handlebar_dict_generator import HandlebarDictGenerator
9 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
10 import third_party.json_schema_compiler.model as model 11 import third_party.json_schema_compiler.model as model
11 import third_party.json_schema_compiler.idl_schema as idl_schema 12 import third_party.json_schema_compiler.idl_schema as idl_schema
12 import third_party.json_schema_compiler.idl_parser as idl_parser 13 import third_party.json_schema_compiler.idl_parser as idl_parser
13 14
14 class APIDataSource(object): 15 class APIDataSource(object):
15 """This class fetches and loads JSON APIs with the fetcher passed in with 16 """This class fetches and loads JSON APIs with the fetcher passed in with
(...skipping 20 matching lines...) Expand all
36 def get(self, key): 37 def get(self, key):
37 path, ext = os.path.splitext(key) 38 path, ext = os.path.splitext(key)
38 unix_name = model.UnixName(path) 39 unix_name = model.UnixName(path)
39 json_path = unix_name + '.json' 40 json_path = unix_name + '.json'
40 idl_path = unix_name + '.idl' 41 idl_path = unix_name + '.idl'
41 try: 42 try:
42 return self._json_cache.GetFromFile(self._base_path + '/' + json_path) 43 return self._json_cache.GetFromFile(self._base_path + '/' + json_path)
43 except Exception: 44 except Exception:
44 try: 45 try:
45 return self._idl_cache.GetFromFile(self._base_path + '/' + idl_path) 46 return self._idl_cache.GetFromFile(self._base_path + '/' + idl_path)
46 except Exception: 47 except Exception as e:
48 logging.warn(e)
47 return None 49 return None
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/appengine_url_fetcher.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698