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

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: Created 7 years, 8 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 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',

Powered by Google App Engine
This is Rietveld 408576698