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

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

Issue 10831269: Extensions Docs Server: BranchUtility not fetching branch numbers correctly (fixed) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better testing and fixes 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/template_data_source.py
diff --git a/chrome/common/extensions/docs/server2/template_data_source.py b/chrome/common/extensions/docs/server2/template_data_source.py
index 5b4cfd5b93b31a565cd40644459c92a0ec78f52c..75fc143a5305044a3926edc207879a760f4bbfc6 100644
--- a/chrome/common/extensions/docs/server2/template_data_source.py
+++ b/chrome/common/extensions/docs/server2/template_data_source.py
@@ -10,16 +10,16 @@ from third_party.handlebar import Handlebar
EXTENSIONS_URL = '/chrome/extensions'
-def _MakeBranchDict(branch):
+def _MakeBranchDict(channel_name):
return {
- 'showWarning': branch != 'stable',
+ 'showWarning': channel_name != 'stable',
'branches': [
not at google - send to devlin 2012/08/13 22:36:46 By the same logic, should rename this to _MakeChan
cduvall 2012/08/13 23:17:22 Done.
{ 'name': 'Stable', 'path': 'stable' },
{ 'name': 'Dev', 'path': 'dev' },
{ 'name': 'Beta', 'path': 'beta' },
{ 'name': 'Trunk', 'path': 'trunk' }
],
- 'current': branch
+ 'current': channel_name
}
class TemplateDataSource(object):
@@ -39,7 +39,7 @@ class TemplateDataSource(object):
individual Requests.
"""
def __init__(self,
- branch,
+ channel_name,
api_data_source_factory,
api_list_data_source,
intro_data_source,
@@ -47,9 +47,7 @@ class TemplateDataSource(object):
cache_builder,
public_template_path,
private_template_path):
- self._branch_info = _MakeBranchDict(branch)
- self._static_resources = ((('/' + branch) if branch != 'local' else '') +
- '/static')
+ self._branch_info = _MakeBranchDict(channel_name)
self._api_data_source_factory = api_data_source_factory
self._api_list_data_source = api_list_data_source
self._intro_data_source = intro_data_source
@@ -57,13 +55,14 @@ class TemplateDataSource(object):
self._cache = cache_builder.build(Handlebar)
self._public_template_path = public_template_path
self._private_template_path = private_template_path
+ self._static_resources = (
+ (('/' + channel_name) if channel_name != 'local' else '') + '/static')
def Create(self, request):
"""Returns a new TemplateDataSource bound to |request|.
"""
return TemplateDataSource(
self._branch_info,
- self._static_resources,
self._api_data_source_factory.Create(request),
self._api_list_data_source,
self._intro_data_source,
@@ -71,11 +70,11 @@ class TemplateDataSource(object):
self._cache,
self._public_template_path,
self._private_template_path,
+ self._static_resources,
request)
def __init__(self,
branch_info,
- static_resources,
api_data_source,
api_list_data_source,
intro_data_source,
@@ -83,9 +82,9 @@ class TemplateDataSource(object):
cache,
public_template_path,
private_template_path,
+ static_resources,
request):
self._branch_info = branch_info
- self._static_resources = static_resources
self._api_list_data_source = api_list_data_source
self._intro_data_source = intro_data_source
self._samples_data_source = samples_data_source
@@ -93,6 +92,7 @@ class TemplateDataSource(object):
self._cache = cache
self._public_template_path = public_template_path
self._private_template_path = private_template_path
+ self._static_resources = static_resources
self._request = request
def Render(self, template_name):

Powered by Google App Engine
This is Rietveld 408576698