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

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

Issue 10825067: Extensions Docs Server: Apps samples page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: less is_apps and fixes Created 8 years, 4 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 import logging 5 import logging
6 6
7 from docs_server_utils import FormatKey 7 from docs_server_utils import FormatKey
8 from file_system import FileNotFoundError 8 from file_system import FileNotFoundError
9 from third_party.handlebar import Handlebar 9 from third_party.handlebar import Handlebar
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return '' 105 return ''
106 # TODO error handling 106 # TODO error handling
107 return template.render({ 107 return template.render({
108 'api_list': self._api_list_data_source, 108 'api_list': self._api_list_data_source,
109 'apis': self._api_data_source, 109 'apis': self._api_data_source,
110 'branchInfo': self._branch_info, 110 'branchInfo': self._branch_info,
111 'intros': self._intro_data_source, 111 'intros': self._intro_data_source,
112 'partials': self, 112 'partials': self,
113 'samples': self._samples_data_source, 113 'samples': self._samples_data_source,
114 'static': self._static_resources, 114 'static': self._static_resources,
115 'apps_title': 'Apps',
116 'extensions_title': 'Extensions',
115 'true': True, 117 'true': True,
116 'false': False 118 'false': False
117 }).text 119 }).text
118 120
119 def __getitem__(self, key): 121 def __getitem__(self, key):
120 return self.get(key) 122 return self.get(key)
121 123
122 def get(self, key): 124 def get(self, key):
123 return self.GetTemplate(self._private_template_path, key) 125 return self.GetTemplate(self._private_template_path, key)
124 126
125 def GetTemplate(self, base_path, template_name): 127 def GetTemplate(self, base_path, template_name):
126 real_path = FormatKey(template_name) 128 real_path = FormatKey(template_name)
127 try: 129 try:
128 return self._cache.GetFromFile(base_path + '/' + real_path) 130 return self._cache.GetFromFile(base_path + '/' + real_path)
129 except FileNotFoundError as e: 131 except FileNotFoundError as e:
130 logging.error(e) 132 logging.error(e)
131 return None 133 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698