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

Unified Diff: chrome/common/extensions/docs/server2/template_data_source.py

Issue 151773002: Docserver: Properly implement the Cron logic for ContentProvider and TemplateDataSource so that the… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoz + rebase Created 6 years, 10 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 aa1ee543038420f497abccacbf7ab6c71a5089da..ffd23857d1271dcbd59ab6099b97b5a9ff67950d 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)

Powered by Google App Engine
This is Rietveld 408576698