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

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

Issue 10804036: Extensions Docs Server: Internationalized samples (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
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 from path_utils import FormatKey 5 from path_utils import FormatKey
6 from third_party.handlebar import Handlebar 6 from third_party.handlebar import Handlebar
7 7
8 EXTENSIONS_URL = '/chrome/extensions' 8 EXTENSIONS_URL = '/chrome/extensions'
9 9
10 def _MakeBranchDict(branch): 10 def _MakeBranchDict(branch):
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 intro_data_source, 70 intro_data_source,
71 samples_data_source, 71 samples_data_source,
72 cache, 72 cache,
73 base_paths, 73 base_paths,
74 request): 74 request):
75 self._branch_info = branch_info 75 self._branch_info = branch_info
76 self._static_resources = static_resources 76 self._static_resources = static_resources
77 self._api_data_source = api_data_source 77 self._api_data_source = api_data_source
78 self._intro_data_source = intro_data_source 78 self._intro_data_source = intro_data_source
79 self._samples_data_source = samples_data_source 79 self._samples_data_source = samples_data_source
80 self._samples_data_source.SetHeaders(request.headers)
not at google - send to devlin 2012/07/20 01:28:21 This isn't safe with multiple requests needing to
cduvall 2012/07/20 19:40:50 Done.
80 self._cache = cache 81 self._cache = cache
81 self._base_paths = base_paths 82 self._base_paths = base_paths
82 self._request = request 83 self._request = request
83 84
84 def Render(self, template_name): 85 def Render(self, template_name):
85 """This method will render a template named |template_name|, fetching all 86 """This method will render a template named |template_name|, fetching all
86 the partial templates needed from |self._cache|. Partials are retrieved 87 the partial templates needed from |self._cache|. Partials are retrieved
87 from the TemplateDataSource with the |get| method. 88 from the TemplateDataSource with the |get| method.
88 """ 89 """
89 template = self.get(template_name) 90 template = self.get(template_name)
(...skipping 13 matching lines...) Expand all
103 return self.get(key) 104 return self.get(key)
104 105
105 def get(self, key): 106 def get(self, key):
106 real_path = FormatKey(key) 107 real_path = FormatKey(key)
107 for base_path in self._base_paths: 108 for base_path in self._base_paths:
108 try: 109 try:
109 return self._cache.GetFromFile(base_path + '/' + real_path) 110 return self._cache.GetFromFile(base_path + '/' + real_path)
110 except Exception: 111 except Exception:
111 pass 112 pass
112 return None 113 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698