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

Unified Diff: chrome/common/extensions/docs/server2/github_file_system.py

Issue 15009006: Docserver: refactor Servlet, ObjectStore, and ServerInstance architecture to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cduvall, redirect fix Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/github_file_system.py
diff --git a/chrome/common/extensions/docs/server2/github_file_system.py b/chrome/common/extensions/docs/server2/github_file_system.py
index 97f694f6b7962e76f093ee06834d9a637131901c..1b9569af6c2978832c02a7ade6d09fafa7ec957b 100644
--- a/chrome/common/extensions/docs/server2/github_file_system.py
+++ b/chrome/common/extensions/docs/server2/github_file_system.py
@@ -5,13 +5,15 @@
import json
import logging
import os
+from StringIO import StringIO
import appengine_blobstore as blobstore
+from appengine_url_fetcher import AppEngineUrlFetcher
from appengine_wrappers import GetAppVersion, urlfetch
from file_system import FileSystem, StatInfo
from future import Future
from object_store_creator import ObjectStoreCreator
-from StringIO import StringIO
+import url_constants
from zipfile import ZipFile, BadZipfile
ZIP_KEY = 'zipball'
@@ -65,12 +67,23 @@ class _AsyncFetchFutureZip(object):
return return_zip
class GithubFileSystem(FileSystem):
- """FileSystem implementation which fetches resources from github.
- """
- def __init__(self, fetcher, blobstore):
- # The password store is the same for all branches and versions.
- password_store = (ObjectStoreCreator.GlobalFactory()
- .Create(GithubFileSystem).Create(category='password'))
+ @staticmethod
+ def Create(object_store_creator):
+ return GithubFileSystem(
+ AppEngineUrlFetcher(url_constants.GITHUB_URL),
+ blobstore.AppEngineBlobstore(),
+ object_store_creator)
+
+ def __init__(self, fetcher, blobstore, object_store_creator):
+ # Password store doesn't depend on channel, and if we don't cancel the app
+ # version then the whole advantage of having it in the first place is
+ # greatly lessened (likewise it should always start populated).
+ password_store = object_store_creator.Create(
+ GithubFileSystem,
+ channel=None,
+ app_version=None,
+ category='password',
+ start_empty=False)
if USERNAME is None:
password_data = password_store.GetMulti(('username', 'password')).Get()
self._username, self._password = (password_data.get('username'),
@@ -81,8 +94,10 @@ class GithubFileSystem(FileSystem):
self._fetcher = fetcher
self._blobstore = blobstore
- self._stat_object_store = (ObjectStoreCreator.SharedFactory(GetAppVersion())
- .Create(GithubFileSystem).Create())
+ # Github has no knowledge of Chrome channels, set channel to None.
+ self._stat_object_store = object_store_creator.Create(
+ GithubFileSystem,
+ channel=None)
self._version = None
self._GetZip(self.Stat(ZIP_KEY).version)

Powered by Google App Engine
This is Rietveld 408576698