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

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

Issue 10834329: Extension docs server: many changes to bring down the latency of the server, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 else: 68 else:
69 svn_url = _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH 69 svn_url = _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH
70 stat_fetcher = AppEngineUrlFetcher( 70 stat_fetcher = AppEngineUrlFetcher(
71 svn_url.replace(url_constants.SVN_URL, url_constants.VIEWVC_URL)) 71 svn_url.replace(url_constants.SVN_URL, url_constants.VIEWVC_URL))
72 fetcher = AppEngineUrlFetcher(svn_url) 72 fetcher = AppEngineUrlFetcher(svn_url)
73 file_system = MemcacheFileSystem( 73 file_system = MemcacheFileSystem(
74 SubversionFileSystem(fetcher, stat_fetcher), 74 SubversionFileSystem(fetcher, stat_fetcher),
75 AppEngineMemcache(branch)) 75 AppEngineMemcache(branch))
76 76
77 cache_builder = FileSystemCache.Builder(file_system) 77 cache_builder = FileSystemCache.Builder(file_system)
78 api_list_data_source = APIListDataSource(cache_builder, 78 api_list_data_source_factory = APIListDataSource.Factory(cache_builder,
79 file_system, 79 file_system,
80 API_PATH, 80 API_PATH,
81 PUBLIC_TEMPLATE_PATH) 81 PUBLIC_TEMPLATE_PATH)
82 intro_data_source = IntroDataSource(cache_builder, 82 intro_data_source_factory = IntroDataSource.Factory(
83 [INTRO_PATH, ARTICLE_PATH]) 83 cache_builder,
84 [INTRO_PATH, ARTICLE_PATH])
84 samples_data_source_factory = SamplesDataSource.Factory(branch, 85 samples_data_source_factory = SamplesDataSource.Factory(branch,
85 file_system, 86 file_system,
86 GITHUB_FILE_SYSTEM, 87 GITHUB_FILE_SYSTEM,
87 cache_builder, 88 cache_builder,
88 GITHUB_CACHE_BUILDER, 89 GITHUB_CACHE_BUILDER,
89 EXAMPLES_PATH) 90 EXAMPLES_PATH)
90 api_data_source_factory = APIDataSource.Factory(cache_builder, 91 api_data_source_factory = APIDataSource.Factory(cache_builder,
91 API_PATH, 92 API_PATH,
92 samples_data_source_factory) 93 samples_data_source_factory)
93 template_data_source_factory = TemplateDataSource.Factory( 94 template_data_source_factory = TemplateDataSource.Factory(
94 channel_name, 95 channel_name,
95 api_data_source_factory, 96 api_data_source_factory,
96 api_list_data_source, 97 api_list_data_source_factory,
97 intro_data_source, 98 intro_data_source_factory,
98 samples_data_source_factory, 99 samples_data_source_factory,
99 cache_builder, 100 cache_builder,
100 PUBLIC_TEMPLATE_PATH, 101 PUBLIC_TEMPLATE_PATH,
101 PRIVATE_TEMPLATE_PATH) 102 PRIVATE_TEMPLATE_PATH)
102 example_zipper = ExampleZipper(file_system, 103 example_zipper = ExampleZipper(file_system,
103 cache_builder, 104 cache_builder,
104 DOCS_PATH, 105 DOCS_PATH,
105 EXAMPLES_PATH) 106 EXAMPLES_PATH)
106 SERVER_INSTANCES[branch] = ServerInstance( 107 SERVER_INSTANCES[branch] = ServerInstance(
107 template_data_source_factory, 108 template_data_source_factory,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 self._NavigateToPath('apps/samples.html') 152 self._NavigateToPath('apps/samples.html')
152 return 153 return
153 154
154 # Redirect paths like "directory" to "directory/". This is so relative file 155 # Redirect paths like "directory" to "directory/". This is so relative file
155 # paths will know to treat this as a directory. 156 # paths will know to treat this as a directory.
156 if os.path.splitext(path)[1] == '' and path[-1] != '/': 157 if os.path.splitext(path)[1] == '' and path[-1] != '/':
157 self.redirect(path + '/') 158 self.redirect(path + '/')
158 path = path.replace('/chrome/', '') 159 path = path.replace('/chrome/', '')
159 path = path.strip('/') 160 path = path.strip('/')
160 self._NavigateToPath(path) 161 self._NavigateToPath(path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698