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

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

Issue 10894049: Make links to samples and re-enable sample list for api references. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: patch'd Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/samples_data_source.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 os 6 import os
7 7
8 from file_system import FileNotFoundError 8 from file_system import FileNotFoundError
9 import compiled_file_system as compiled_fs 9 import compiled_file_system as compiled_fs
10 from handlebar_dict_generator import HandlebarDictGenerator 10 from handlebar_dict_generator import HandlebarDictGenerator
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 api_perms = perms.get(path, None) 89 api_perms = perms.get(path, None)
90 if api_perms is None: 90 if api_perms is None:
91 return None 91 return None
92 if api_perms['channel'] == 'dev': 92 if api_perms['channel'] == 'dev':
93 api_perms['dev'] = True 93 api_perms['dev'] = True
94 return api_perms 94 return api_perms
95 95
96 def _GenerateHandlebarContext(self, handlebar, path): 96 def _GenerateHandlebarContext(self, handlebar, path):
97 return_dict = { 97 return_dict = {
98 'permissions': self._GetFeature(path), 98 'permissions': self._GetFeature(path),
99 # Disabled to help with performance until we figure out 99 'samples': _LazySamplesGetter(path, self._samples)
100 # http://crbug.com/142011.
101 'samples': None # _LazySamplesGetter(path, self._samples)
102 } 100 }
103 return_dict.update(handlebar.Generate()) 101 return_dict.update(handlebar.Generate())
104 return return_dict 102 return return_dict
105 103
106 def __getitem__(self, key): 104 def __getitem__(self, key):
107 return self.get(key) 105 return self.get(key)
108 106
109 def get(self, key): 107 def get(self, key):
110 path, ext = os.path.splitext(key) 108 path, ext = os.path.splitext(key)
111 unix_name = model.UnixName(path) 109 unix_name = model.UnixName(path)
112 idl_names = self._idl_names_cache.GetFromFileListing(self._base_path) 110 idl_names = self._idl_names_cache.GetFromFileListing(self._base_path)
113 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else 111 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else
114 (self._json_cache, '.json')) 112 (self._json_cache, '.json'))
115 return self._GenerateHandlebarContext( 113 return self._GenerateHandlebarContext(
116 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), 114 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)),
117 path) 115 path)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/samples_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698