Chromium Code Reviews| 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 |