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 aa1ee543038420f497abccacbf7ab6c71a5089da..7fbd7e192247e9b8a5269c3aa8eb89c32e338670 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 Future, Gettable |
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,9 @@ 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] |
+ return Future(delegate=Gettable(lambda: [f.Get() for f in futures])) |