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

Unified Diff: chrome/common/extensions/docs/server2/branch_utility.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/branch_utility.py
diff --git a/chrome/common/extensions/docs/server2/branch_utility.py b/chrome/common/extensions/docs/server2/branch_utility.py
index 633c5f3a6df26ef1bd3c406f93adc4dca8da4c9b..0dd43d102637f061a065074980889ebebb71a404 100644
--- a/chrome/common/extensions/docs/server2/branch_utility.py
+++ b/chrome/common/extensions/docs/server2/branch_utility.py
@@ -6,25 +6,26 @@ import json
import logging
import operator
-from appengine_wrappers import GetAppVersion
-from object_store_creator import ObjectStoreCreator
+from appengine_url_fetcher import AppEngineUrlFetcher
+import url_constants
class BranchUtility(object):
- def __init__(self, fetch_url, fetcher, object_store=None):
+ def __init__(self, fetch_url, fetcher, object_store_creator):
self._fetch_url = fetch_url
self._fetcher = fetcher
- if object_store is None:
- object_store = (ObjectStoreCreator.SharedFactory(GetAppVersion())
- .Create(BranchUtility).Create())
- self._object_store = object_store
+ # BranchUtility is obviously cross-channel, so set the channel to None.
+ self._object_store = object_store_creator.Create(BranchUtility,
+ channel=None)
@staticmethod
- def GetAllBranchNames():
- return ['stable', 'beta', 'dev', 'trunk']
+ def Create(object_store_creator):
+ return BranchUtility(url_constants.OMAHA_PROXY_URL,
+ AppEngineUrlFetcher(),
+ object_store_creator)
- def GetAllBranchNumbers(self):
- return [(branch, self.GetBranchNumberForChannelName(branch))
- for branch in BranchUtility.GetAllBranchNames()]
+ @staticmethod
+ def GetAllChannelNames():
+ return ['stable', 'beta', 'dev', 'trunk']
@staticmethod
def SplitChannelNameFromPath(path):
@@ -40,7 +41,7 @@ class BranchUtility(object):
return (first, second)
return (None, path)
- def GetBranchNumberForChannelName(self, channel_name):
+ def GetBranchForChannel(self, channel_name):
"""Returns the branch number for a channel name.
"""
if channel_name == 'trunk':

Powered by Google App Engine
This is Rietveld 408576698