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

Side by Side Diff: chrome/common/extensions/docs/server2/template_data_source.py

Issue 63203002: Docserver: Make the hand-written Cron methods run first rather than last, since (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/docs/server2/strings_data_source.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import posixpath 6 import posixpath
7 import traceback 7 import traceback
8 8
9 from data_source import DataSource 9 from data_source import DataSource
10 from docs_server_utils import FormatKey 10 from docs_server_utils import FormatKey
11 from file_system import FileNotFoundError 11 from file_system import FileNotFoundError
12 from future import Future
12 from svn_constants import PRIVATE_TEMPLATE_PATH 13 from svn_constants import PRIVATE_TEMPLATE_PATH
13 14
14 15
15 class TemplateDataSource(DataSource): 16 class TemplateDataSource(DataSource):
16 '''Provides a DataSource interface for compiled templates. 17 '''Provides a DataSource interface for compiled templates.
17 ''' 18 '''
18 19
19 def __init__(self, server_instance, _, partial_dir=PRIVATE_TEMPLATE_PATH): 20 def __init__(self, server_instance, _, partial_dir=PRIVATE_TEMPLATE_PATH):
20 self._template_cache = server_instance.compiled_fs_factory.ForTemplates( 21 self._template_cache = server_instance.compiled_fs_factory.ForTemplates(
21 server_instance.host_file_system_provider.GetTrunk()) 22 server_instance.host_file_system_provider.GetTrunk())
22 self._partial_dir = partial_dir 23 self._partial_dir = partial_dir
23 24
24 def get(self, path): 25 def get(self, path):
25 try: 26 try:
26 return self._template_cache.GetFromFile('%s/%s.html' % 27 return self._template_cache.GetFromFile('%s/%s.html' %
27 (self._partial_dir, path)).Get() 28 (self._partial_dir, path)).Get()
28 except FileNotFoundError: 29 except FileNotFoundError:
29 logging.warning(traceback.format_exc()) 30 logging.warning(traceback.format_exc())
30 return None 31 return None
31 32
32 def Cron(self): 33 def Cron(self):
33 # TODO(kalman): Implement this; probably by finding all files that can be 34 # TODO(kalman): Implement this; probably by finding all files that can be
34 # compiled to templates underneath |self._partial_dir| and compiling them. 35 # compiled to templates underneath |self._partial_dir| and compiling them.
35 pass 36 return Future(value=())
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/strings_data_source.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698