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

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

Issue 10836223: Extensions Docs Server: Disable samples on API pages to help performance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: {} -> None Created 8 years, 4 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 | no next file » | 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 logging
7 import os 7 import os
8 8
9 from file_system import FileNotFoundError 9 from file_system import FileNotFoundError
10 from handlebar_dict_generator import HandlebarDictGenerator 10 from handlebar_dict_generator import HandlebarDictGenerator
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 api_perms = perms.get(path, None) 78 api_perms = perms.get(path, None)
79 if api_perms is None: 79 if api_perms is None:
80 return None 80 return None
81 if api_perms['channel'] == 'dev': 81 if api_perms['channel'] == 'dev':
82 api_perms['dev'] = True 82 api_perms['dev'] = True
83 return api_perms 83 return api_perms
84 84
85 def _GenerateHandlebarContext(self, handlebar, path): 85 def _GenerateHandlebarContext(self, handlebar, path):
86 return_dict = { 86 return_dict = {
87 'permissions': self._GetFeature(path), 87 'permissions': self._GetFeature(path),
88 'samples': _LazySamplesGetter(path, self._samples) 88 # Disabled to help with performance until we figure out
89 # http://crbug.com/142011.
90 'samples': None # _LazySamplesGetter(path, self._samples)
89 } 91 }
90 return_dict.update(handlebar.Generate()) 92 return_dict.update(handlebar.Generate())
91 return return_dict 93 return return_dict
92 94
93 def __getitem__(self, key): 95 def __getitem__(self, key):
94 return self.get(key) 96 return self.get(key)
95 97
96 def get(self, key): 98 def get(self, key):
97 path, ext = os.path.splitext(key) 99 path, ext = os.path.splitext(key)
98 unix_name = model.UnixName(path) 100 unix_name = model.UnixName(path)
99 json_path = unix_name + '.json' 101 json_path = unix_name + '.json'
100 idl_path = unix_name + '.idl' 102 idl_path = unix_name + '.idl'
101 try: 103 try:
102 return self._GenerateHandlebarContext( 104 return self._GenerateHandlebarContext(
103 self._json_cache.GetFromFile(self._base_path + '/' + json_path), 105 self._json_cache.GetFromFile(self._base_path + '/' + json_path),
104 path) 106 path)
105 except FileNotFoundError: 107 except FileNotFoundError:
106 try: 108 try:
107 return self._GenerateHandlebarContext( 109 return self._GenerateHandlebarContext(
108 self._idl_cache.GetFromFile(self._base_path + '/' + idl_path), 110 self._idl_cache.GetFromFile(self._base_path + '/' + idl_path),
109 path) 111 path)
110 except FileNotFoundError: 112 except FileNotFoundError:
111 raise 113 raise
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698