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

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

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: add executable bits for tests Created 7 years, 7 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 (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 fnmatch import fnmatch 5 from fnmatch import fnmatch
6 import logging 6 import logging
7 import mimetypes 7 import mimetypes
8 import traceback 8 import traceback
9 import os 9 import os
10 10
(...skipping 21 matching lines...) Expand all
32 from template_data_source import TemplateDataSource 32 from template_data_source import TemplateDataSource
33 from test_object_store import TestObjectStore 33 from test_object_store import TestObjectStore
34 from third_party.json_schema_compiler.model import UnixName 34 from third_party.json_schema_compiler.model import UnixName
35 import url_constants 35 import url_constants
36 36
37 class ServerInstance(object): 37 class ServerInstance(object):
38 def __init__(self, 38 def __init__(self,
39 channel, 39 channel,
40 object_store_creator, 40 object_store_creator,
41 host_file_system, 41 host_file_system,
42 app_samples_file_system): 42 app_samples_file_system,
43 static_path,
44 compiled_fs_factory):
43 self.channel = channel 45 self.channel = channel
44 46
45 self.object_store_creator = object_store_creator 47 self.object_store_creator = object_store_creator
46 48
47 self.host_file_system = host_file_system 49 self.host_file_system = host_file_system
48 50
49 self.app_samples_file_system = app_samples_file_system 51 self.app_samples_file_system = app_samples_file_system
50 52
51 self.compiled_host_fs_factory = CompiledFileSystem.Factory( 53 self.compiled_host_fs_factory = compiled_fs_factory
52 host_file_system,
53 object_store_creator)
54 54
55 self.api_list_data_source_factory = APIListDataSource.Factory( 55 self.api_list_data_source_factory = APIListDataSource.Factory(
56 self.compiled_host_fs_factory, 56 self.compiled_host_fs_factory,
57 svn_constants.API_PATH, 57 svn_constants.API_PATH,
58 svn_constants.PUBLIC_TEMPLATE_PATH) 58 svn_constants.PUBLIC_TEMPLATE_PATH)
59 59
60 self.api_data_source_factory = APIDataSource.Factory( 60 self.api_data_source_factory = APIDataSource.Factory(
61 self.compiled_host_fs_factory, 61 self.compiled_host_fs_factory,
62 svn_constants.API_PATH) 62 svn_constants.API_PATH)
63 63
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 self.template_data_source_factory = TemplateDataSource.Factory( 100 self.template_data_source_factory = TemplateDataSource.Factory(
101 channel, 101 channel,
102 self.api_data_source_factory, 102 self.api_data_source_factory,
103 self.api_list_data_source_factory, 103 self.api_list_data_source_factory,
104 self.intro_data_source_factory, 104 self.intro_data_source_factory,
105 self.samples_data_source_factory, 105 self.samples_data_source_factory,
106 self.sidenav_data_source_factory, 106 self.sidenav_data_source_factory,
107 self.compiled_host_fs_factory, 107 self.compiled_host_fs_factory,
108 self.ref_resolver_factory, 108 self.ref_resolver_factory,
109 svn_constants.PUBLIC_TEMPLATE_PATH, 109 svn_constants.PUBLIC_TEMPLATE_PATH,
110 svn_constants.PRIVATE_TEMPLATE_PATH) 110 svn_constants.PRIVATE_TEMPLATE_PATH,
111 static_path)
111 112
112 self.example_zipper = ExampleZipper( 113 self.example_zipper = ExampleZipper(
113 self.compiled_host_fs_factory, 114 self.compiled_host_fs_factory,
114 svn_constants.DOCS_PATH) 115 svn_constants.DOCS_PATH)
115 116
116 self.path_canonicalizer = PathCanonicalizer( 117 self.path_canonicalizer = PathCanonicalizer(
117 channel, 118 channel,
118 self.compiled_host_fs_factory) 119 self.compiled_host_fs_factory)
119 120
120 self.content_cache = self.compiled_host_fs_factory.CreateIdentity( 121 self.content_cache = self.compiled_host_fs_factory.CreateIdentity(
121 ServerInstance) 122 ServerInstance)
122 123
123 @staticmethod 124 @staticmethod
124 def ForTest(file_system): 125 def ForTest(file_system):
126 object_store_creator = ObjectStoreCreator.ForTest()
125 return ServerInstance('test', 127 return ServerInstance('test',
126 ObjectStoreCreator.ForTest(), 128 object_store_creator,
127 file_system, 129 file_system,
128 EmptyDirFileSystem()) 130 EmptyDirFileSystem(),
131 '/static',
132 CompiledFileSystem.Factory(file_system,
133 object_store_creator))
129 134
130 @staticmethod 135 @staticmethod
131 def ForLocal(): 136 def ForLocal():
132 channel = 'trunk' 137 channel = 'trunk'
133 object_store_creator = ObjectStoreCreator(channel, 138 object_store_creator = ObjectStoreCreator(channel,
134 start_empty=False, 139 start_empty=False,
135 store_type=TestObjectStore) 140 store_type=TestObjectStore)
141 file_system = CachingFileSystem(LocalFileSystem.Create(),
142 object_store_creator)
136 return ServerInstance( 143 return ServerInstance(
137 channel, 144 channel,
138 object_store_creator, 145 object_store_creator,
139 CachingFileSystem(LocalFileSystem.Create(), object_store_creator), 146 file_system,
140 EmptyDirFileSystem()) 147 EmptyDirFileSystem(),
148 '/static',
149 CompiledFileSystem.Factory(file_system, object_store_creator))
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/robots.txt ('k') | chrome/common/extensions/docs/server2/servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698