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

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

Issue 12996003: Dynamically generate a heading for Extension Docs API pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AvailabilityFinder Overhaul; Removing ConfigureFakeFetchers() calls Created 7 years, 6 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 5 import logging
6 import time 6 import time
7 import traceback 7 import traceback
8 8
9 from app_yaml_helper import AppYamlHelper 9 from app_yaml_helper import AppYamlHelper
10 from appengine_wrappers import ( 10 from appengine_wrappers import (
(...skipping 28 matching lines...) Expand all
39 39
40 class Delegate(object): 40 class Delegate(object):
41 '''CronServlet's runtime dependencies. Override for testing. 41 '''CronServlet's runtime dependencies. Override for testing.
42 ''' 42 '''
43 def CreateBranchUtility(self, object_store_creator): 43 def CreateBranchUtility(self, object_store_creator):
44 return BranchUtility.Create(object_store_creator) 44 return BranchUtility.Create(object_store_creator)
45 45
46 def CreateHostFileSystemForBranchAndRevision(self, branch, revision): 46 def CreateHostFileSystemForBranchAndRevision(self, branch, revision):
47 return SubversionFileSystem.Create(branch, revision=revision) 47 return SubversionFileSystem.Create(branch, revision=revision)
48 48
49 def CreateFileSystemForBranch(self, branch):
50 return SubversionFileSystem.Create(branch)
51
49 def CreateAppSamplesFileSystem(self, object_store_creator): 52 def CreateAppSamplesFileSystem(self, object_store_creator):
50 # TODO(kalman): CachingFileSystem wrapper for GithubFileSystem, but it's 53 # TODO(kalman): CachingFileSystem wrapper for GithubFileSystem, but it's
51 # not supported yet (see comment there). 54 # not supported yet (see comment there).
52 return (EmptyDirFileSystem() if IsDevServer() else 55 return (EmptyDirFileSystem() if IsDevServer() else
53 GithubFileSystem.Create(object_store_creator)) 56 GithubFileSystem.Create(object_store_creator))
54 57
55 def GetAppVersion(self): 58 def GetAppVersion(self):
56 return GetAppVersion() 59 return GetAppVersion()
57 60
58 def Get(self): 61 def Get(self):
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 channel, delegate.GetAppVersion(), safe_revision)) 213 channel, delegate.GetAppVersion(), safe_revision))
211 214
212 return self._CreateServerInstance(channel, safe_revision) 215 return self._CreateServerInstance(channel, safe_revision)
213 216
214 def _CreateObjectStoreCreator(self, channel): 217 def _CreateObjectStoreCreator(self, channel):
215 return ObjectStoreCreator(channel, start_empty=True) 218 return ObjectStoreCreator(channel, start_empty=True)
216 219
217 def _GetBranchForChannel(self, channel): 220 def _GetBranchForChannel(self, channel):
218 object_store_creator = self._CreateObjectStoreCreator(channel) 221 object_store_creator = self._CreateObjectStoreCreator(channel)
219 return (self._delegate.CreateBranchUtility(object_store_creator) 222 return (self._delegate.CreateBranchUtility(object_store_creator)
220 .GetBranchForChannel(channel)) 223 .GetChannelInfo(channel).branch)
221 224
222 def _CreateServerInstance(self, channel, revision): 225 def _CreateServerInstance(self, channel, revision):
223 object_store_creator = self._CreateObjectStoreCreator(channel) 226 object_store_creator = self._CreateObjectStoreCreator(channel)
224 host_file_system = CachingFileSystem( 227 host_file_system = CachingFileSystem(
225 self._delegate.CreateHostFileSystemForBranchAndRevision( 228 self._delegate.CreateHostFileSystemForBranchAndRevision(
226 self._GetBranchForChannel(channel), 229 self._GetBranchForChannel(channel),
227 revision), 230 revision),
228 object_store_creator) 231 object_store_creator)
229 app_samples_file_system = self._delegate.CreateAppSamplesFileSystem( 232 app_samples_file_system = self._delegate.CreateAppSamplesFileSystem(
230 object_store_creator) 233 object_store_creator)
231 compiled_host_fs_factory = CompiledFileSystem.Factory( 234 compiled_host_fs_factory = CompiledFileSystem.Factory(
232 host_file_system, 235 host_file_system,
233 object_store_creator) 236 object_store_creator)
237 branch_utility = self._delegate.CreateBranchUtility(object_store_creator)
238 def create_file_system(version):
239 return CachingFileSystem(
240 self._delegate.CreateFileSystemForBranch(
241 branch_utility.GetBranchNumberForVersion(version)),
242 object_store_creator)
234 return ServerInstance(channel, 243 return ServerInstance(channel,
235 object_store_creator, 244 object_store_creator,
236 host_file_system, 245 host_file_system,
237 app_samples_file_system, 246 app_samples_file_system,
238 '' if channel == 'stable' else '/%s' % channel, 247 '' if channel == 'stable' else '/%s' % channel,
239 compiled_host_fs_factory) 248 compiled_host_fs_factory,
249 branch_utility,
epeterson 2013/06/02 00:25:50 Passing a branch utility to AvailabilityFinder via
250 create_file_system)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698