OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 # Add the original server location to sys.path so we are able to import | 10 # Add the original server location to sys.path so we are able to import |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 AppEngineMemcache(branch, memcache)) | 78 AppEngineMemcache(branch, memcache)) |
79 | 79 |
80 cache_builder = FileSystemCache.Builder(file_system) | 80 cache_builder = FileSystemCache.Builder(file_system) |
81 api_data_source = APIDataSource(cache_builder, API_PATH) | 81 api_data_source = APIDataSource(cache_builder, API_PATH) |
82 api_list_data_source = APIListDataSource(cache_builder, | 82 api_list_data_source = APIListDataSource(cache_builder, |
83 file_system, | 83 file_system, |
84 API_PATH, | 84 API_PATH, |
85 PUBLIC_TEMPLATE_PATH) | 85 PUBLIC_TEMPLATE_PATH) |
86 intro_data_source = IntroDataSource(cache_builder, | 86 intro_data_source = IntroDataSource(cache_builder, |
87 [INTRO_PATH, ARTICLE_PATH]) | 87 [INTRO_PATH, ARTICLE_PATH]) |
88 samples_data_source = SamplesDataSource(file_system, | 88 samples_data_source_factory = SamplesDataSource.Factory(file_system, |
89 cache_builder, | 89 cache_builder, |
90 EXAMPLES_PATH) | 90 EXAMPLES_PATH) |
91 template_data_source_factory = TemplateDataSource.Factory( | 91 template_data_source_factory = TemplateDataSource.Factory( |
92 branch, | 92 branch, |
93 api_data_source, | 93 api_data_source, |
94 api_list_data_source, | 94 api_list_data_source, |
95 intro_data_source, | 95 intro_data_source, |
96 samples_data_source, | 96 samples_data_source_factory, |
97 cache_builder, | 97 cache_builder, |
98 PUBLIC_TEMPLATE_PATH, | 98 PUBLIC_TEMPLATE_PATH, |
99 PRIVATE_TEMPLATE_PATH) | 99 PRIVATE_TEMPLATE_PATH) |
100 example_zipper = ExampleZipper(file_system, | 100 example_zipper = ExampleZipper(file_system, |
101 cache_builder, | 101 cache_builder, |
102 DOCS_PATH, | 102 DOCS_PATH, |
103 EXAMPLES_PATH) | 103 EXAMPLES_PATH) |
104 SERVER_INSTANCES[branch] = ServerInstance( | 104 SERVER_INSTANCES[branch] = ServerInstance( |
105 template_data_source_factory, | 105 template_data_source_factory, |
106 example_zipper, | 106 example_zipper, |
(...skipping 20 matching lines...) Expand all Loading... |
127 channel_name, real_path = BRANCH_UTILITY.SplitChannelNameFromPath(path) | 127 channel_name, real_path = BRANCH_UTILITY.SplitChannelNameFromPath(path) |
128 branch = BRANCH_UTILITY.GetBranchNumberForChannelName(channel_name) | 128 branch = BRANCH_UTILITY.GetBranchNumberForChannelName(channel_name) |
129 if real_path == '': | 129 if real_path == '': |
130 real_path = 'index.html' | 130 real_path = 'index.html' |
131 # TODO: This leaks Server instances when branch bumps. | 131 # TODO: This leaks Server instances when branch bumps. |
132 self._GetInstanceForBranch(branch).Get(real_path, | 132 self._GetInstanceForBranch(branch).Get(real_path, |
133 self.request, | 133 self.request, |
134 self.response) | 134 self.response) |
135 | 135 |
136 def main(): | 136 def main(): |
137 handlers = [ | 137 run_wsgi_app(webapp.WSGIApplication([('/.*', Handler)], debug=False)) |
138 ('/.*', Handler), | |
139 ] | |
140 run_wsgi_app(webapp.WSGIApplication(handlers, debug=False)) | |
141 | |
142 | 138 |
143 if __name__ == '__main__': | 139 if __name__ == '__main__': |
144 main() | 140 main() |
OLD | NEW |