| OLD | NEW |
| 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 from appengine_wrappers import webapp | 9 from appengine_wrappers import webapp |
| 10 from appengine_wrappers import memcache | 10 from appengine_wrappers import memcache |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 return SERVER_INSTANCES[branch] | 61 return SERVER_INSTANCES[branch] |
| 62 if branch == 'local': | 62 if branch == 'local': |
| 63 file_system = LocalFileSystem(local_path) | 63 file_system = LocalFileSystem(local_path) |
| 64 else: | 64 else: |
| 65 fetcher = AppEngineUrlFetcher( | 65 fetcher = AppEngineUrlFetcher( |
| 66 _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH) | 66 _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH) |
| 67 file_system = MemcacheFileSystem(SubversionFileSystem(fetcher), | 67 file_system = MemcacheFileSystem(SubversionFileSystem(fetcher), |
| 68 AppEngineMemcache(branch)) | 68 AppEngineMemcache(branch)) |
| 69 | 69 |
| 70 cache_builder = FileSystemCache.Builder(file_system) | 70 cache_builder = FileSystemCache.Builder(file_system) |
| 71 api_data_source = APIDataSource(cache_builder, API_PATH) | |
| 72 api_list_data_source = APIListDataSource(cache_builder, | 71 api_list_data_source = APIListDataSource(cache_builder, |
| 73 file_system, | 72 file_system, |
| 74 API_PATH, | 73 API_PATH, |
| 75 PUBLIC_TEMPLATE_PATH) | 74 PUBLIC_TEMPLATE_PATH) |
| 76 intro_data_source = IntroDataSource(cache_builder, | 75 intro_data_source = IntroDataSource(cache_builder, |
| 77 [INTRO_PATH, ARTICLE_PATH]) | 76 [INTRO_PATH, ARTICLE_PATH]) |
| 78 samples_data_source_factory = SamplesDataSource.Factory(branch, | 77 samples_data_source_factory = SamplesDataSource.Factory(branch, |
| 79 file_system, | 78 file_system, |
| 80 cache_builder, | 79 cache_builder, |
| 81 EXAMPLES_PATH) | 80 EXAMPLES_PATH) |
| 81 api_data_source_factory = APIDataSource.Factory(cache_builder, |
| 82 API_PATH, |
| 83 samples_data_source_factory) |
| 82 template_data_source_factory = TemplateDataSource.Factory( | 84 template_data_source_factory = TemplateDataSource.Factory( |
| 83 branch, | 85 branch, |
| 84 api_data_source, | 86 api_data_source_factory, |
| 85 api_list_data_source, | 87 api_list_data_source, |
| 86 intro_data_source, | 88 intro_data_source, |
| 87 samples_data_source_factory, | 89 samples_data_source_factory, |
| 88 cache_builder, | 90 cache_builder, |
| 89 PUBLIC_TEMPLATE_PATH, | 91 PUBLIC_TEMPLATE_PATH, |
| 90 PRIVATE_TEMPLATE_PATH) | 92 PRIVATE_TEMPLATE_PATH) |
| 91 example_zipper = ExampleZipper(file_system, | 93 example_zipper = ExampleZipper(file_system, |
| 92 cache_builder, | 94 cache_builder, |
| 93 DOCS_PATH, | 95 DOCS_PATH, |
| 94 EXAMPLES_PATH) | 96 EXAMPLES_PATH) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 self._NavigateToPath('stable/samples.html') | 131 self._NavigateToPath('stable/samples.html') |
| 130 return | 132 return |
| 131 | 133 |
| 132 # Redirect paths like "directory" to "directory/". This is so relative file | 134 # Redirect paths like "directory" to "directory/". This is so relative file |
| 133 # paths will know to treat this as a directory. | 135 # paths will know to treat this as a directory. |
| 134 if os.path.splitext(path)[1] == '' and path[-1] != '/': | 136 if os.path.splitext(path)[1] == '' and path[-1] != '/': |
| 135 self.redirect(path + '/') | 137 self.redirect(path + '/') |
| 136 path = path.replace('/chrome/extensions/', '') | 138 path = path.replace('/chrome/extensions/', '') |
| 137 path = path.strip('/') | 139 path = path.strip('/') |
| 138 self._NavigateToPath(path) | 140 self._NavigateToPath(path) |
| OLD | NEW |