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

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

Issue 14218004: Devserver: only populate data during cron jobs, meaning all data from instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PTAL Created 7 years, 8 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
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 copy 5 import copy
6 import logging 6 import logging
7 import os 7 import os
8 8
9 from file_system import FileNotFoundError 9 from file_system import FileNotFoundError
10 import third_party.json_schema_compiler.json_parse as json_parse 10 import third_party.json_schema_compiler.json_parse as json_parse
11 import third_party.json_schema_compiler.model as model 11 import third_party.json_schema_compiler.model as model
12 import third_party.json_schema_compiler.idl_schema as idl_schema 12 import third_party.json_schema_compiler.idl_schema as idl_schema
13 import third_party.json_schema_compiler.idl_parser as idl_parser 13 import third_party.json_schema_compiler.idl_parser as idl_parser
14 14
15 # Increment this if the data model changes for APIDataSource. 15 # Increment this if the data model changes for APIDataSource.
16 # This would include changes to model.py in json_schema_compiler! 16 # This would include changes to model.py in json_schema_compiler!
17 _VERSION = 17 17 _VERSION = 17
18 18
19 def _RemoveNoDocs(item): 19 def _RemoveNoDocs(item):
20 if json_parse.IsDict(item): 20 if json_parse.IsDict(item):
21 if item.get('nodoc', False): 21 if item.get('nodoc', False):
22 return True 22 return True
23 to_remove = []
24 for key, value in item.items(): 23 for key, value in item.items():
25 if _RemoveNoDocs(value): 24 if _RemoveNoDocs(value):
26 to_remove.append(key) 25 del item[key]
27 for k in to_remove:
28 del item[k]
29 elif type(item) == list: 26 elif type(item) == list:
30 to_remove = [] 27 to_remove = []
31 for i in item: 28 for i in item:
32 if _RemoveNoDocs(i): 29 if _RemoveNoDocs(i):
33 to_remove.append(i) 30 to_remove.append(i)
34 for i in to_remove: 31 for i in to_remove:
35 item.remove(i) 32 item.remove(i)
36 return False 33 return False
37 34
38 def _CreateId(node, prefix): 35 def _CreateId(node, prefix):
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 if self._disable_refs: 445 if self._disable_refs:
449 cache, ext = ( 446 cache, ext = (
450 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else 447 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else
451 (self._json_cache_no_refs, '.json')) 448 (self._json_cache_no_refs, '.json'))
452 else: 449 else:
453 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else 450 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else
454 (self._json_cache, '.json')) 451 (self._json_cache, '.json'))
455 return self._GenerateHandlebarContext( 452 return self._GenerateHandlebarContext(
456 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), 453 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)),
457 path) 454 path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698