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

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

Issue 63203002: Docserver: Make the hand-written Cron methods run first rather than last, since (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 1 month 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 | chrome/common/extensions/docs/server2/api_models.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 from operator import itemgetter 5 from operator import itemgetter
6 import os 6 import os
7 import posixpath 7 import posixpath
8 8
9 from svn_constants import PUBLIC_TEMPLATE_PATH 9 from svn_constants import PUBLIC_TEMPLATE_PATH
10 import docs_server_utils as utils 10 import docs_server_utils as utils
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return [name.replace('_', '.') for name in template_names] 59 return [name.replace('_', '.') for name in template_names]
60 api_names = set(utils.SanitizeAPIName(name) for name in files) 60 api_names = set(utils.SanitizeAPIName(name) for name in files)
61 return { 61 return {
62 'apps': GetDocumentedAPIsForPlatform(api_names, 'apps'), 62 'apps': GetDocumentedAPIsForPlatform(api_names, 'apps'),
63 'extensions': GetDocumentedAPIsForPlatform(api_names, 'extensions') 63 'extensions': GetDocumentedAPIsForPlatform(api_names, 'extensions')
64 } 64 }
65 65
66 def _GenerateAPIDict(self): 66 def _GenerateAPIDict(self):
67 documented_apis = self._cache.GetFromFileListing( 67 documented_apis = self._cache.GetFromFileListing(
68 PUBLIC_TEMPLATE_PATH).Get() 68 PUBLIC_TEMPLATE_PATH).Get()
69 api_features = self._features_bundle.GetAPIFeatures() 69 api_features = self._features_bundle.GetAPIFeatures().Get()
70 70
71 def FilterAPIs(platform): 71 def FilterAPIs(platform):
72 return (api for api in api_features.itervalues() 72 return (api for api in api_features.itervalues()
73 if platform in api['platforms']) 73 if platform in api['platforms'])
74 74
75 def MakeDictForPlatform(platform): 75 def MakeDictForPlatform(platform):
76 platform_dict = { 'chrome': [], 'experimental': [], 'private': [] } 76 platform_dict = { 'chrome': [], 'experimental': [], 'private': [] }
77 for api in FilterAPIs(platform): 77 for api in FilterAPIs(platform):
78 if api['name'] in documented_apis[platform]: 78 if api['name'] in documented_apis[platform]:
79 category = _GetAPICategory(api, documented_apis[platform]) 79 category = _GetAPICategory(api, documented_apis[platform])
(...skipping 17 matching lines...) Expand all
97 97
98 def _GetCachedAPIData(self): 98 def _GetCachedAPIData(self):
99 data = self._object_store.Get('api_data').Get() 99 data = self._object_store.Get('api_data').Get()
100 if data is None: 100 if data is None:
101 data = self._factory._GenerateAPIDict() 101 data = self._factory._GenerateAPIDict()
102 self._object_store.Set('api_data', data) 102 self._object_store.Set('api_data', data)
103 return data 103 return data
104 104
105 def get(self, key): 105 def get(self, key):
106 return self._GetCachedAPIData().get(key) 106 return self._GetCachedAPIData().get(key)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_models.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698