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

Unified Diff: chrome/common/extensions/docs/server2/samples_data_source.py

Issue 38923003: Docserver: Fix missing samples in some API reference pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/samples_data_source.py
diff --git a/chrome/common/extensions/docs/server2/samples_data_source.py b/chrome/common/extensions/docs/server2/samples_data_source.py
index 449914bc2d3d1c73601d9c5d58fe146168a11b02..9a57fba423a1f2d1eebf76b3eb40331cbcdda94f 100644
--- a/chrome/common/extensions/docs/server2/samples_data_source.py
+++ b/chrome/common/extensions/docs/server2/samples_data_source.py
@@ -191,21 +191,9 @@ class SamplesDataSource(object):
only the samples that use the API |api_name|. |key| is either 'apps' or
'extensions'.
'''
- api_search = api_name.replace('.', '_') + '_'
- samples_list = []
- try:
- for sample in self.get(key):
- api_calls_unix = [model.UnixName(call['name'])
- for call in sample['api_calls']]
- for call in api_calls_unix:
- if call.startswith(api_search):
- samples_list.append(sample)
- break
- except NotImplementedError:
- # If we're testing, the GithubFileSystem can't fetch samples.
- # Bug: http://crbug.com/141910
- return []
- return samples_list
+ return [sample for sample in self.get(key) if any(
+ call['name'].startswith(api_name + '.')
+ for call in sample['api_calls'])]
def _CreateSamplesDict(self, key):
if key == 'apps':
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698