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

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

Issue 575613003: Docserver: Gitiles auth and cron refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/api_list_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 logging
6
5 from data_source import DataSource 7 from data_source import DataSource
6 from docs_server_utils import StringIdentity 8 from docs_server_utils import StringIdentity
7 from environment import IsPreviewServer 9 from environment import IsPreviewServer
8 from file_system import FileNotFoundError 10 from file_system import FileNotFoundError
9 from future import Future, All 11 from future import Future, All
10 from jsc_view import JSCView, GetEventByNameFromEvents 12 from jsc_view import JSCView, GetEventByNameFromEvents
11 from platform_util import GetPlatforms 13 from platform_util import GetPlatforms
12 from samples_data_source import CreateSamplesView 14 from samples_data_source import CreateSamplesView
13 15
14 16
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return Future(callback=resolve) 84 return Future(callback=resolve)
83 85
84 def get(self, platform): 86 def get(self, platform):
85 '''Return a getter object so that templates can perform lookups such 87 '''Return a getter object so that templates can perform lookups such
86 as apis.extensions.runtime. 88 as apis.extensions.runtime.
87 ''' 89 '''
88 getter = lambda: 0 90 getter = lambda: 0
89 getter.get = lambda api_name: self._GetImpl(platform, api_name).Get() 91 getter.get = lambda api_name: self._GetImpl(platform, api_name).Get()
90 return getter 92 return getter
91 93
92 def Cron(self): 94 def GetRefreshPaths(self):
93 futures = [] 95 tasks = []
94 for platform in GetPlatforms(): 96 for platform in GetPlatforms():
95 futures += [self._GetImpl(platform, name) 97 tasks += ['%s/%s' % (platform, api)
96 for name in self._platform_bundle.GetAPIModels(platform).GetNames()] 98 for api in
97 return All(futures, except_pass=FileNotFoundError) 99 self._platform_bundle.GetAPIModels(platform).GetNames()]
100 return tasks
101
102 def Refresh(self, path):
103 platform, api = path.split('/')
104 logging.info('Refreshing %s/%s' % (platform, api))
105 future = self._GetImpl(platform, api)
106 return All([future], except_pass=FileNotFoundError)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_list_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698