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 eae53303e5d01c0d561df7757db575e5d2c81bee..a32107c0e16c3ebff6a433bc16cdcd63f5d63321 100644 |
| --- a/chrome/common/extensions/docs/server2/template_data_source.py |
| +++ b/chrome/common/extensions/docs/server2/template_data_source.py |
| @@ -2,14 +2,17 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +import json |
| import logging |
| import os |
| import traceback |
| from branch_utility import BranchUtility |
| import compiled_file_system as compiled_fs |
| +from compiled_file_system_source import CompiledFileSystemSource as CSFSource |
| from docs_server_utils import FormatKey |
| from file_system import FileNotFoundError |
| +from svn_constants import JSON_PATH |
| from third_party.handlebar import Handlebar |
| import url_constants |
| @@ -64,6 +67,9 @@ class TemplateDataSource(object): |
| self._public_template_path = public_template_path |
| self._private_template_path = private_template_path |
| self._static_resources = '/%s/static' % channel_name |
| + self._manifest_json = compiled_fs_factory.Create( |
| + lambda _, contents: json.loads(contents), TemplateDataSource) |
|
not at google - send to devlin
2013/04/30 16:21:09
Use compiled_fs_factory.CreateIdentity() here.
be
jshumway
2013/05/03 03:44:39
Done.
|
| + |
| def _CreateTemplate(self, template_name, text): |
| return Handlebar(self._ref_resolver.ResolveAllLinks(text)) |
| @@ -78,6 +84,7 @@ class TemplateDataSource(object): |
| self._intro_data_source_factory.Create(), |
| self._samples_data_source_factory.Create(request), |
| self._sidenav_data_source_factory.Create(path), |
| + self._manifest_json, |
| self._cache, |
| self._public_template_path, |
| self._private_template_path, |
| @@ -90,6 +97,7 @@ class TemplateDataSource(object): |
| intro_data_source, |
| samples_data_source, |
| sidenav_data_source, |
| + manifest_json, |
| cache, |
| public_template_path, |
| private_template_path, |
| @@ -104,6 +112,14 @@ class TemplateDataSource(object): |
| self._public_template_path = public_template_path |
| self._private_template_path = private_template_path |
| self._static_resources = static_resources |
| + self._manifest_json = CSFSource( |
| + manifest_json, JSON_PATH, lambda key: key + '.json') |
| + |
| + # import types |
| + |
| + # self._manifest_json.get = types.MethodType( |
| + # lambda self, key: self.GetFromFile(os.path.join(JSON_PATH, key + '.json')), |
| + # self._manifest_json) |
|
not at google - send to devlin
2013/04/30 16:21:09
delete?
jshumway
2013/05/03 03:44:39
Done.
|
| def Render(self, template_name): |
| """This method will render a template named |template_name|, fetching all |
| @@ -121,6 +137,7 @@ class TemplateDataSource(object): |
| 'intros': self._intro_data_source, |
| 'sidenavs': self._sidenav_data_source, |
| 'partials': self, |
| + 'manifest_json': self._manifest_json, |
| 'samples': self._samples_data_source, |
| 'static': self._static_resources, |
| 'app': 'app', |