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

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

Issue 10828235: Extensions Docs Server: Efficient MemcacheFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes and comments 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 # Global cache of instances because Handler is recreated for every request. 59 # Global cache of instances because Handler is recreated for every request.
60 SERVER_INSTANCES = {} 60 SERVER_INSTANCES = {}
61 61
62 def _GetInstanceForBranch(channel_name, local_path): 62 def _GetInstanceForBranch(channel_name, local_path):
63 branch = BRANCH_UTILITY.GetBranchNumberForChannelName(channel_name) 63 branch = BRANCH_UTILITY.GetBranchNumberForChannelName(channel_name)
64 if branch in SERVER_INSTANCES: 64 if branch in SERVER_INSTANCES:
65 return SERVER_INSTANCES[branch] 65 return SERVER_INSTANCES[branch]
66 if branch == 'local': 66 if branch == 'local':
67 file_system = LocalFileSystem(local_path) 67 file_system = LocalFileSystem(local_path)
68 else: 68 else:
69 fetcher = AppEngineUrlFetcher( 69 svn_url = _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH
70 _GetURLFromBranch(branch) + '/' + EXTENSIONS_PATH) 70 stat_fetcher = AppEngineUrlFetcher(
71 file_system = MemcacheFileSystem(SubversionFileSystem(fetcher), 71 svn_url.replace(url_constants.SVN_URL, url_constants.VIEWVC_URL))
72 AppEngineMemcache(branch)) 72 fetcher = AppEngineUrlFetcher(svn_url)
73 file_system = MemcacheFileSystem(
74 SubversionFileSystem(fetcher, stat_fetcher),
75 AppEngineMemcache(branch))
73 76
74 cache_builder = FileSystemCache.Builder(file_system) 77 cache_builder = FileSystemCache.Builder(file_system)
75 api_list_data_source = APIListDataSource(cache_builder, 78 api_list_data_source = APIListDataSource(cache_builder,
76 file_system, 79 file_system,
77 API_PATH, 80 API_PATH,
78 PUBLIC_TEMPLATE_PATH) 81 PUBLIC_TEMPLATE_PATH)
79 intro_data_source = IntroDataSource(cache_builder, 82 intro_data_source = IntroDataSource(cache_builder,
80 [INTRO_PATH, ARTICLE_PATH]) 83 [INTRO_PATH, ARTICLE_PATH])
81 samples_data_source_factory = SamplesDataSource.Factory(branch, 84 samples_data_source_factory = SamplesDataSource.Factory(branch,
82 file_system, 85 file_system,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 self._NavigateToPath('apps/samples.html') 151 self._NavigateToPath('apps/samples.html')
149 return 152 return
150 153
151 # Redirect paths like "directory" to "directory/". This is so relative file 154 # Redirect paths like "directory" to "directory/". This is so relative file
152 # paths will know to treat this as a directory. 155 # paths will know to treat this as a directory.
153 if os.path.splitext(path)[1] == '' and path[-1] != '/': 156 if os.path.splitext(path)[1] == '' and path[-1] != '/':
154 self.redirect(path + '/') 157 self.redirect(path + '/')
155 path = path.replace('/chrome/', '') 158 path = path.replace('/chrome/', '')
156 path = path.strip('/') 159 path = path.strip('/')
157 self._NavigateToPath(path) 160 self._NavigateToPath(path)
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/file_system.py ('k') | chrome/common/extensions/docs/server2/local_file_system.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698