Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/server_instance.py |
| =================================================================== |
| --- chrome/common/extensions/docs/server2/server_instance.py (revision 198269) |
| +++ chrome/common/extensions/docs/server2/server_instance.py (working copy) |
| @@ -24,8 +24,10 @@ |
| from local_file_system import LocalFileSystem |
| from object_store_creator import ObjectStoreCreator |
| from offline_file_system import OfflineFileSystem |
| +from patched_file_system import PatchedFileSystem |
| from path_canonicalizer import PathCanonicalizer |
| from reference_resolver import ReferenceResolver |
| +from rietveld_patcher import RietveldPatcher |
| from samples_data_source import SamplesDataSource |
| from sidenav_data_source import SidenavDataSource |
| from subversion_file_system import SubversionFileSystem |
| @@ -46,7 +48,7 @@ |
| @staticmethod |
| @memoize |
| - def GetOrCreateOffline(channel): |
| + def GetOrCreateOffline(channel, static_path=None, issue=None): |
| '''Gets/creates a local ServerInstance, meaning that only resources local to |
| the server - memcache, object store, etc, are queried. This amounts to not |
| setting up the subversion nor github file systems. |
| @@ -55,22 +57,26 @@ |
| branch = branch_utility.GetBranchNumberForChannelName(channel) |
| object_store_creator_factory = ObjectStoreCreator.Factory(GetAppVersion(), |
| branch) |
| + svn_file_system = CachingFileSystem(OfflineFileSystem(SubversionFileSystem), |
|
not at google - send to devlin
2013/05/04 06:47:43
moving this up here seems cosmetic - please move i
方觉(Fang Jue)
2013/05/04 10:47:18
It was moved because when I did this there wasn't
|
| + object_store_creator_factory, |
| + use_existing_values=True) |
| + |
| # No svn nor github file systems. Rely on the crons to fill the caches, and |
| # for the caches to exist. |
| - return ServerInstance( |
| + return ServerInstance._CreateWithPatch( |
| channel, |
| + static_path, |
| object_store_creator_factory, |
| - CachingFileSystem(OfflineFileSystem(SubversionFileSystem), |
| - object_store_creator_factory, |
| - use_existing_values=True), |
| + svn_file_system, |
| # TODO(kalman): convert GithubFileSystem to be wrappable in a |
| # CachingFileSystem so that it can be replaced with an |
| # OfflineFileSystem. Currently GFS doesn't set the child versions of |
| # stat requests so it doesn't. |
| - ServerInstance._GetOrCreateGithubFileSystem()) |
| + ServerInstance._GetOrCreateGithubFileSystem(), |
| + issue) |
| @staticmethod |
| - def CreateOnline(channel): |
| + def CreateOnline(channel, static_path=None, issue=None): |
| '''Creates/creates an online server instance, meaning that both local and |
| subversion/github resources are queried. |
| ''' |
| @@ -98,14 +104,42 @@ |
| AppEngineUrlFetcher(viewvc_url)), |
| object_store_creator_factory) |
| + return ServerInstance._CreateWithPatch( |
| + channel, |
| + static_path, |
| + object_store_creator_factory, |
| + svn_file_system, |
| + ServerInstance._GetOrCreateGithubFileSystem(), |
| + issue) |
| + |
| + @staticmethod |
| + def _CreateWithPatch(channel, |
| + static_path, |
| + object_store_creator_factory, |
| + svn_file_system, |
| + github_file_system, |
| + issue=None): |
| + if issue is not None: |
| + object_store_creator_factory = ObjectStoreCreator.Factory( |
| + GetAppVersion(), |
| + 'trunk@%s' % issue) |
| + rietveld_patcher = RietveldPatcher( |
| + svn_constants.EXTENSIONS_PATH, |
| + issue, |
| + AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER), |
| + object_store_creator_factory) |
| + svn_file_system = PatchedFileSystem(svn_file_system, |
| + rietveld_patcher) |
| return ServerInstance(channel, |
| + static_path, |
| object_store_creator_factory, |
| svn_file_system, |
| - ServerInstance._GetOrCreateGithubFileSystem()) |
| + github_file_system) |
| @staticmethod |
| def CreateForTest(file_system): |
| return ServerInstance('test', |
| + None, |
| ObjectStoreCreator.TestFactory(), |
| file_system, |
| None) |
| @@ -133,6 +167,7 @@ |
| def __init__(self, |
| channel, |
| + static_path, |
| object_store_creator_factory, |
| svn_file_system, |
| github_file_system): |
| @@ -198,7 +233,8 @@ |
| self.compiled_fs_factory, |
| self.ref_resolver_factory, |
| svn_constants.PUBLIC_TEMPLATE_PATH, |
| - svn_constants.PRIVATE_TEMPLATE_PATH) |
| + svn_constants.PRIVATE_TEMPLATE_PATH, |
| + static_path) |
| self.example_zipper = ExampleZipper( |
| self.compiled_fs_factory, |