Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/api_list_data_source.py |
| diff --git a/chrome/common/extensions/docs/server2/api_list_data_source.py b/chrome/common/extensions/docs/server2/api_list_data_source.py |
| index 0204d749dbcc3b5baa2fecc4142b50db98544e99..1405e6e60aa9ddd0ad473aaf9a411bf4e0a03a05 100644 |
| --- a/chrome/common/extensions/docs/server2/api_list_data_source.py |
| +++ b/chrome/common/extensions/docs/server2/api_list_data_source.py |
| @@ -19,22 +19,29 @@ class APIListDataSource(object): |
| def _ListAPIs(self, apis): |
| api_names = set(SanitizeAPIName(name, self._api_path) for name in apis) |
| - public_templates = self._file_system.ReadSingle(self._public_path) |
| - template_names = [os.path.splitext(name)[0] for name in public_templates] |
| - experimental_apis = [] |
| - chrome_apis = [] |
| - for i, template_name in enumerate(sorted(template_names)): |
| - if model.UnixName(template_name) in api_names: |
| - if template_name.startswith('experimental'): |
| - experimental_apis.append({ 'name': template_name.replace('_', '.') }) |
| - else: |
| - chrome_apis.append({ 'name': template_name.replace('_', '.') }) |
| - chrome_apis[-1]['last'] = True |
| - experimental_apis[-1]['last'] = True |
| - return { |
| - 'chrome': chrome_apis, |
| - 'experimental': experimental_apis |
| - } |
| + return_dict = {} |
|
not at google - send to devlin
2012/08/06 08:38:33
nit: I would have structured this like
return {
cduvall
2012/08/06 18:36:16
Done.
|
| + for doc_type in ['apps', 'extensions']: |
| + public_templates = self._file_system.ReadSingle( |
| + self._public_path + doc_type + '/') |
| + template_names = [os.path.splitext(name)[0] |
| + for name in public_templates] |
| + experimental_apis = [] |
| + chrome_apis = [] |
| + for i, template_name in enumerate(sorted(template_names)): |
| + if model.UnixName(template_name) in api_names: |
| + if template_name.startswith('experimental'): |
| + experimental_apis.append({ |
| + 'name': template_name.replace('_', '.') |
| + }) |
| + else: |
| + chrome_apis.append({ 'name': template_name.replace('_', '.') }) |
| + chrome_apis[-1]['last'] = True |
| + experimental_apis[-1]['last'] = True |
| + return_dict[doc_type] = { |
| + 'chrome': chrome_apis, |
| + 'experimental': experimental_apis |
| + } |
| + return return_dict |
| def __getitem__(self, key): |
| return self.get(key) |