diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-05 04:25:12 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-05 04:25:12 +0000 |
commit | ab9ad605bed8d9aa8a63585fc84f32270d0917c9 (patch) | |
tree | de413eeb1566bbabf6d87b85876df1d4a431cf5e /chrome/common/extensions/docs/server2/template_data_source.py | |
parent | a87f28d3051782dbb5bb442aa56eb0c9d16bca75 (diff) | |
download | chromium_src-ab9ad605bed8d9aa8a63585fc84f32270d0917c9.zip chromium_src-ab9ad605bed8d9aa8a63585fc84f32270d0917c9.tar.gz chromium_src-ab9ad605bed8d9aa8a63585fc84f32270d0917c9.tar.bz2 |
Docserver: Properly implement the Cron logic for ContentProvider and
TemplateDataSource so that the nacl docs and partial templates are correctly
pulled in by the cronjob. Make the integration tests actually test nacl docs.
BUG=339936
R=yoz@chromium.org
Review URL: https://codereview.chromium.org/151773002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/server2/template_data_source.py')
-rw-r--r-- | chrome/common/extensions/docs/server2/template_data_source.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/chrome/common/extensions/docs/server2/template_data_source.py b/chrome/common/extensions/docs/server2/template_data_source.py index aa1ee543..ffd2385 100644 --- a/chrome/common/extensions/docs/server2/template_data_source.py +++ b/chrome/common/extensions/docs/server2/template_data_source.py @@ -3,12 +3,13 @@ # found in the LICENSE file. import logging +import posixpath import traceback from data_source import DataSource from extensions_paths import PRIVATE_TEMPLATES from file_system import FileNotFoundError -from future import Future +from future import Collect class TemplateDataSource(DataSource): @@ -19,6 +20,7 @@ class TemplateDataSource(DataSource): self._template_cache = server_instance.compiled_fs_factory.ForTemplates( server_instance.host_file_system_provider.GetTrunk()) self._partial_dir = partial_dir + self._file_system = server_instance.host_file_system_provider.GetTrunk() def get(self, path): try: @@ -29,6 +31,10 @@ class TemplateDataSource(DataSource): return None def Cron(self): - # TODO(kalman): Implement this; probably by finding all files that can be - # compiled to templates underneath |self._partial_dir| and compiling them. - return Future(value=()) + futures = [] + for root, _, files in self._file_system.Walk(self._partial_dir): + futures += [self._template_cache.GetFromFile( + posixpath.join(self._partial_dir, root, f)) + for f in files + if posixpath.splitext(f)[1] == '.html'] + return Collect(futures) |