Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/echo_handler.py |
| diff --git a/chrome/common/extensions/docs/server2/echo_handler.py b/chrome/common/extensions/docs/server2/echo_handler.py |
| index 78195cb94a22d9477d5880410b23507ae2eba67c..6ee080197f6a171619ca1d843384c73ec563dcb2 100755 |
| --- a/chrome/common/extensions/docs/server2/echo_handler.py |
| +++ b/chrome/common/extensions/docs/server2/echo_handler.py |
| @@ -8,7 +8,7 @@ import os |
| # Add the original server location to sys.path so we are able to import |
| # modules from there. |
| -SERVER_PATH = 'chrome/common/extensions/docs/server2/' |
| +SERVER_PATH = 'chrome/common/extensions/docs/server2' |
| if os.path.abspath(SERVER_PATH) not in sys.path: |
| sys.path.append(os.path.abspath(SERVER_PATH)) |
| @@ -19,15 +19,18 @@ import urlfetch |
| from google.appengine.ext import webapp |
| from google.appengine.ext.webapp.util import run_wsgi_app |
| +from api_data_source import APIDataSource |
| +from fetcher_cache import FetcherCache |
| from local_fetcher import LocalFetcher |
| from server_instance import ServerInstance |
| from subversion_fetcher import SubversionFetcher |
| from template_data_source import TemplateDataSource |
| -EXTENSIONS_PATH = 'chrome/common/extensions/' |
| -DOCS_PATH = 'docs/' |
| -PUBLIC_TEMPLATE_PATH = DOCS_PATH + 'template2/public/' |
| -PRIVATE_TEMPLATE_PATH = DOCS_PATH + 'template2/private/' |
| +EXTENSIONS_PATH = 'chrome/common/extensions' |
| +DOCS_PATH = 'docs' |
| +API_PATH = 'api' |
| +PUBLIC_TEMPLATE_PATH = DOCS_PATH + '/template2/public' |
| +PRIVATE_TEMPLATE_PATH = DOCS_PATH + '/template2/private' |
|
not at google - send to devlin
2012/06/18 19:30:40
these are filesystem paths right? Should be os.pat
cduvall
2012/06/18 19:48:46
These are URLs. When they are used as filesystem p
|
| # Global cache of instances because the Server is recreated for every request. |
| SERVER_INSTANCES = {} |
| @@ -43,11 +46,15 @@ class Server(webapp.RequestHandler): |
| else: |
| fetcher = SubversionFetcher(branch, EXTENSIONS_PATH, urlfetch) |
| cache_timeout_seconds = 300 |
| - data_source = TemplateDataSource( |
| - fetcher, |
| - [PUBLIC_TEMPLATE_PATH, PRIVATE_TEMPLATE_PATH], |
| - cache_timeout_seconds) |
| - SERVER_INSTANCES[branch] = ServerInstance(data_source, fetcher) |
| + cache_builder = FetcherCache.Builder(fetcher, cache_timeout_seconds) |
| + template_data_source = TemplateDataSource( |
| + cache_builder, |
| + [PUBLIC_TEMPLATE_PATH, PRIVATE_TEMPLATE_PATH]) |
| + api_data_source = APIDataSource(cache_builder, [API_PATH]) |
| + SERVER_INSTANCES[branch] = ServerInstance( |
| + api_data_source, |
| + template_data_source, |
| + fetcher) |
| return SERVER_INSTANCES[branch] |
| def _HandleRequest(self, path): |