From ab9ad605bed8d9aa8a63585fc84f32270d0917c9 Mon Sep 17 00:00:00 2001 From: "kalman@chromium.org" Date: Wed, 5 Feb 2014 04:25:12 +0000 Subject: 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 --- .../common/extensions/docs/server2/template_data_source.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to '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 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) -- cgit v1.1