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 from StringIO import StringIO | 7 from StringIO import StringIO |
8 import sys | 8 import sys |
9 | 9 |
10 from appengine_wrappers import webapp | 10 from appengine_wrappers import webapp |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 cache_factory = CompiledFileSystem.Factory(file_system, branch_memcache) | 87 cache_factory = CompiledFileSystem.Factory(file_system, branch_memcache) |
88 api_list_data_source_factory = APIListDataSource.Factory(cache_factory, | 88 api_list_data_source_factory = APIListDataSource.Factory(cache_factory, |
89 file_system, | 89 file_system, |
90 API_PATH, | 90 API_PATH, |
91 PUBLIC_TEMPLATE_PATH) | 91 PUBLIC_TEMPLATE_PATH) |
92 intro_data_source_factory = IntroDataSource.Factory( | 92 intro_data_source_factory = IntroDataSource.Factory( |
93 cache_factory, | 93 cache_factory, |
94 [INTRO_PATH, ARTICLE_PATH]) | 94 [INTRO_PATH, ARTICLE_PATH]) |
95 samples_data_source_factory = SamplesDataSource.Factory( | 95 samples_data_source_factory = SamplesDataSource.Factory( |
96 branch, | 96 channel_name, |
97 file_system, | 97 file_system, |
98 GITHUB_FILE_SYSTEM, | 98 GITHUB_FILE_SYSTEM, |
99 cache_factory, | 99 cache_factory, |
100 GITHUB_COMPILED_FILE_SYSTEM, | 100 GITHUB_COMPILED_FILE_SYSTEM, |
101 EXAMPLES_PATH) | 101 EXAMPLES_PATH) |
102 api_data_source_factory = APIDataSource.Factory(cache_factory, | 102 api_data_source_factory = APIDataSource.Factory(cache_factory, |
103 API_PATH, | 103 API_PATH, |
104 samples_data_source_factory) | 104 samples_data_source_factory) |
105 template_data_source_factory = TemplateDataSource.Factory( | 105 template_data_source_factory = TemplateDataSource.Factory( |
106 channel_name, | 106 channel_name, |
107 api_data_source_factory, | 107 api_data_source_factory, |
108 api_list_data_source_factory, | 108 api_list_data_source_factory, |
109 intro_data_source_factory, | 109 intro_data_source_factory, |
110 samples_data_source_factory, | 110 samples_data_source_factory, |
111 cache_factory, | 111 cache_factory, |
112 PUBLIC_TEMPLATE_PATH, | 112 PUBLIC_TEMPLATE_PATH, |
113 PRIVATE_TEMPLATE_PATH) | 113 PRIVATE_TEMPLATE_PATH) |
114 example_zipper = ExampleZipper(file_system, | 114 example_zipper = ExampleZipper(file_system, |
115 cache_factory, | 115 cache_factory, |
116 DOCS_PATH, | 116 DOCS_PATH) |
117 EXAMPLES_PATH) | |
118 SERVER_INSTANCES[branch] = ServerInstance( | 117 SERVER_INSTANCES[branch] = ServerInstance( |
119 template_data_source_factory, | 118 template_data_source_factory, |
120 example_zipper, | 119 example_zipper, |
121 cache_factory) | 120 cache_factory) |
122 return SERVER_INSTANCES[branch] | 121 return SERVER_INSTANCES[branch] |
123 | 122 |
124 def _GetURLFromBranch(branch): | 123 def _GetURLFromBranch(branch): |
125 if branch == 'trunk': | 124 if branch == 'trunk': |
126 return url_constants.SVN_TRUNK_URL + '/src' | 125 return url_constants.SVN_TRUNK_URL + '/src' |
127 return url_constants.SVN_BRANCH_URL + '/' + branch + '/src' | 126 return url_constants.SVN_BRANCH_URL + '/' + branch + '/src' |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if path.startswith('/cron'): | 190 if path.startswith('/cron'): |
192 self._HandleCron(path) | 191 self._HandleCron(path) |
193 else: | 192 else: |
194 # Redirect paths like "directory" to "directory/". This is so relative | 193 # Redirect paths like "directory" to "directory/". This is so relative |
195 # file paths will know to treat this as a directory. | 194 # file paths will know to treat this as a directory. |
196 if os.path.splitext(path)[1] == '' and path[-1] != '/': | 195 if os.path.splitext(path)[1] == '' and path[-1] != '/': |
197 self.redirect(path + '/') | 196 self.redirect(path + '/') |
198 path = path.replace('/chrome/', '') | 197 path = path.replace('/chrome/', '') |
199 path = path.strip('/') | 198 path = path.strip('/') |
200 self._HandleGet(path) | 199 self._HandleGet(path) |
OLD | NEW |