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

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

Issue 14273041: Doc server manifest page generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: epeterson's nits Created 7 years, 5 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 ca065d331b5ea46005500c66d71fd90149c3f43c..8ae1ecce00632a0d1f7a7a9f56e951562d1e1d9b 100644
--- a/chrome/common/extensions/docs/server2/template_data_source.py
+++ b/chrome/common/extensions/docs/server2/template_data_source.py
@@ -21,6 +21,18 @@ _STRING_CONSTANTS = {
'properties': 'properties',
}
+# TODO-PATCH: Do I actually need this?
+def _MakeChannelDict(channel_name):
not at google - send to devlin 2013/07/20 02:49:03 No I deleted it :)
jshumway 2013/07/22 17:16:27 Ah, oops. Was in a bit of a rush to get it up and
+ channel_dict = {
+ 'channels': [{'name': name} for name in BranchUtility.GetAllChannelNames()],
+ 'current': channel_name
+ }
+
+ for channel in channel_dict['channels']:
+ if channel['name'] == channel_name:
+ channel['isCurrent'] = True
+ return channel_dict
+
class TemplateDataSource(object):
"""Renders Handlebar templates, providing them with the context in which to
render.
@@ -45,6 +57,7 @@ class TemplateDataSource(object):
sidenav_data_source_factory,
compiled_fs_factory,
ref_resolver_factory,
+ manifest_data_source,
public_template_path,
private_template_path,
base_path):
@@ -58,6 +71,7 @@ class TemplateDataSource(object):
self._ref_resolver = ref_resolver_factory.Create()
self._public_template_path = public_template_path
self._private_template_path = private_template_path
+ self._manifest_data_source = manifest_data_source
self._base_path = base_path
def _CreateTemplate(self, template_name, text):
@@ -73,6 +87,7 @@ class TemplateDataSource(object):
self._samples_data_source_factory.Create(request),
self._sidenav_data_source_factory.Create(path),
self._cache,
+ self._manifest_data_source,
self._public_template_path,
self._private_template_path,
self._base_path)
@@ -84,6 +99,7 @@ class TemplateDataSource(object):
samples_data_source,
sidenav_data_source,
cache,
+ manifest_data_source,
public_template_path,
private_template_path,
base_path):
@@ -95,6 +111,7 @@ class TemplateDataSource(object):
self._cache = cache
self._public_template_path = public_template_path
self._private_template_path = private_template_path
+ self._manifest_data_source = manifest_data_source
self._base_path = base_path
def Render(self, template_name):
@@ -112,6 +129,7 @@ class TemplateDataSource(object):
'intros': self._intro_data_source,
'sidenavs': self._sidenav_data_source,
'partials': self,
+ 'manifest_source': self._manifest_data_source,
'samples': self._samples_data_source,
'apps_samples_url': url_constants.GITHUB_BASE,
'extensions_samples_url': url_constants.EXTENSIONS_SAMPLES,
@@ -132,5 +150,5 @@ class TemplateDataSource(object):
try:
return self._cache.GetFromFile(
'/'.join((base_path, FormatKey(template_name))))
- except FileNotFoundError as e:
+ except FileNotFoundError:
return None

Powered by Google App Engine
This is Rietveld 408576698