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

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

Issue 491653002: Docserver: Use GitilesFileSystem instead of SubversionFileSystem (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_data_source_test.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 data_source import DataSource 5 from data_source import DataSource
6 from docs_server_utils import StringIdentity 6 from docs_server_utils import StringIdentity
7 from environment import IsPreviewServer 7 from environment import IsPreviewServer
8 from file_system import FileNotFoundError 8 from file_system import FileNotFoundError
9 from future import Future, All 9 from future import Future, All
10 from jsc_view import JSCView, GetEventByNameFromEvents 10 from jsc_view import JSCView, GetEventByNameFromEvents
11 from platform_util import GetPlatforms 11 from platform_util import GetPlatforms
12 from samples_data_source import CreateSamplesView 12 from samples_data_source import CreateSamplesView
13 13
14 14
15 class APIDataSource(DataSource): 15 class APIDataSource(DataSource):
16 '''This class fetches and loads JSON APIs from the FileSystem passed in with 16 '''This class fetches and loads JSON APIs from the FileSystem passed in with
17 |compiled_fs_factory|, so the APIs can be plugged into templates. 17 |compiled_fs_factory|, so the APIs can be plugged into templates.
18 ''' 18 '''
19 def __init__(self, server_instance, request): 19 def __init__(self, server_instance, request):
20 file_system = server_instance.host_file_system_provider.GetTrunk() 20 file_system = server_instance.host_file_system_provider.GetMaster()
21 self._json_cache = server_instance.compiled_fs_factory.ForJson(file_system) 21 self._json_cache = server_instance.compiled_fs_factory.ForJson(file_system)
22 self._template_cache = server_instance.compiled_fs_factory.ForTemplates( 22 self._template_cache = server_instance.compiled_fs_factory.ForTemplates(
23 file_system) 23 file_system)
24 self._platform_bundle = server_instance.platform_bundle 24 self._platform_bundle = server_instance.platform_bundle
25 self._view_cache = server_instance.object_store_creator.Create( 25 self._view_cache = server_instance.object_store_creator.Create(
26 APIDataSource, 26 APIDataSource,
27 # Update the models when any of templates, APIs, or Features change. 27 # Update the models when any of templates, APIs, or Features change.
28 category=StringIdentity(self._json_cache.GetIdentity(), 28 category=StringIdentity(self._json_cache.GetIdentity(),
29 self._template_cache.GetIdentity(), 29 self._template_cache.GetIdentity(),
30 self._platform_bundle.GetIdentity())) 30 self._platform_bundle.GetIdentity()))
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 getter = lambda: 0 88 getter = lambda: 0
89 getter.get = lambda api_name: self._GetImpl(platform, api_name).Get() 89 getter.get = lambda api_name: self._GetImpl(platform, api_name).Get()
90 return getter 90 return getter
91 91
92 def Cron(self): 92 def Cron(self):
93 futures = [] 93 futures = []
94 for platform in GetPlatforms(): 94 for platform in GetPlatforms():
95 futures += [self._GetImpl(platform, name) 95 futures += [self._GetImpl(platform, name)
96 for name in self._platform_bundle.GetAPIModels(platform).GetNames()] 96 for name in self._platform_bundle.GetAPIModels(platform).GetNames()]
97 return All(futures, except_pass=FileNotFoundError) 97 return All(futures, except_pass=FileNotFoundError)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_data_source_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698