| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 else: | 73 else: |
| 74 fetcher = AppEngineUrlFetcher( | 74 fetcher = AppEngineUrlFetcher( |
| 75 _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH) | 75 _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH) |
| 76 file_system = MemcacheFileSystem(SubversionFileSystem(fetcher), | 76 file_system = MemcacheFileSystem(SubversionFileSystem(fetcher), |
| 77 AppEngineMemcache(branch, memcache)) | 77 AppEngineMemcache(branch, memcache)) |
| 78 | 78 |
| 79 cache_builder = FileSystemCache.Builder(file_system) | 79 cache_builder = FileSystemCache.Builder(file_system) |
| 80 api_data_source = APIDataSource(cache_builder, API_PATH) | 80 api_data_source = APIDataSource(cache_builder, API_PATH) |
| 81 intro_data_source = IntroDataSource(cache_builder, | 81 intro_data_source = IntroDataSource(cache_builder, |
| 82 [INTRO_PATH, ARTICLE_PATH]) | 82 [INTRO_PATH, ARTICLE_PATH]) |
| 83 samples_data_source = SamplesDataSource(file_system, | 83 samples_data_source_factory = SamplesDataSource.Factory(file_system, |
| 84 cache_builder, | 84 cache_builder, |
| 85 EXAMPLES_PATH) | 85 EXAMPLES_PATH) |
| 86 template_data_source_factory = TemplateDataSource.Factory( | 86 template_data_source_factory = TemplateDataSource.Factory( |
| 87 branch, | 87 branch, |
| 88 api_data_source, | 88 api_data_source, |
| 89 intro_data_source, | 89 intro_data_source, |
| 90 samples_data_source, | 90 samples_data_source_factory, |
| 91 cache_builder, | 91 cache_builder, |
| 92 [PUBLIC_TEMPLATE_PATH, PRIVATE_TEMPLATE_PATH]) | 92 [PUBLIC_TEMPLATE_PATH, PRIVATE_TEMPLATE_PATH]) |
| 93 example_zipper = ExampleZipper(file_system, | 93 example_zipper = ExampleZipper(file_system, |
| 94 cache_builder, | 94 cache_builder, |
| 95 DOCS_PATH, | 95 DOCS_PATH, |
| 96 EXAMPLES_PATH) | 96 EXAMPLES_PATH) |
| 97 SERVER_INSTANCES[branch] = ServerInstance( | 97 SERVER_INSTANCES[branch] = ServerInstance( |
| 98 template_data_source_factory, | 98 template_data_source_factory, |
| 99 example_zipper, | 99 example_zipper, |
| 100 cache_builder) | 100 cache_builder) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 120 channel_name, real_path = BRANCH_UTILITY.SplitChannelNameFromPath(path) | 120 channel_name, real_path = BRANCH_UTILITY.SplitChannelNameFromPath(path) |
| 121 branch = BRANCH_UTILITY.GetBranchNumberForChannelName(channel_name) | 121 branch = BRANCH_UTILITY.GetBranchNumberForChannelName(channel_name) |
| 122 if real_path == '': | 122 if real_path == '': |
| 123 real_path = 'index.html' | 123 real_path = 'index.html' |
| 124 # TODO: This leaks Server instances when branch bumps. | 124 # TODO: This leaks Server instances when branch bumps. |
| 125 self._GetInstanceForBranch(branch).Get(real_path, | 125 self._GetInstanceForBranch(branch).Get(real_path, |
| 126 self.request, | 126 self.request, |
| 127 self.response) | 127 self.response) |
| 128 | 128 |
| 129 def main(): | 129 def main(): |
| 130 handlers = [ | 130 run_wsgi_app(webapp.WSGIApplication([('/.*', Handler)], debug=False)) |
| 131 ('/.*', Handler), | |
| 132 ] | |
| 133 run_wsgi_app(webapp.WSGIApplication(handlers, debug=False)) | |
| 134 | |
| 135 | 131 |
| 136 if __name__ == '__main__': | 132 if __name__ == '__main__': |
| 137 main() | 133 main() |
| OLD | NEW |