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

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

Issue 10834144: Extensions Docs Server: Split apps from extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 third_party.handlebar import Handlebar 8 from third_party.handlebar import Handlebar
9 9
10 EXTENSIONS_URL = '/chrome/extensions' 10 EXTENSIONS_URL = '/chrome/extensions'
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if not template: 103 if not template:
104 return '' 104 return ''
105 # TODO error handling 105 # TODO error handling
106 return template.render({ 106 return template.render({
107 'api_list': self._api_list_data_source, 107 'api_list': self._api_list_data_source,
108 'apis': self._api_data_source, 108 'apis': self._api_data_source,
109 'branchInfo': self._branch_info, 109 'branchInfo': self._branch_info,
110 'intros': self._intro_data_source, 110 'intros': self._intro_data_source,
111 'partials': self, 111 'partials': self,
112 'samples': self._samples_data_source, 112 'samples': self._samples_data_source,
113 'static': self._static_resources 113 'static': self._static_resources,
114 'TRUE': True,
115 'FALSE': False
not at google - send to devlin 2012/08/06 22:01:24 hah! nice. (would have preferred lower case thoug
cduvall 2012/08/06 22:25:45 Done.
114 }).text 116 }).text
115 117
116 def __getitem__(self, key): 118 def __getitem__(self, key):
117 return self.get(key) 119 return self.get(key)
118 120
119 def get(self, key): 121 def get(self, key):
120 return self.GetTemplate(self._private_template_path, key) 122 return self.GetTemplate(self._private_template_path, key)
121 123
122 def GetTemplate(self, base_path, template_name): 124 def GetTemplate(self, base_path, template_name):
123 real_path = FormatKey(template_name) 125 real_path = FormatKey(template_name)
124 try: 126 try:
125 return self._cache.GetFromFile(base_path + '/' + real_path) 127 return self._cache.GetFromFile(base_path + '/' + real_path)
126 except Exception as e: 128 except Exception as e:
127 logging.error(e) 129 logging.error(e)
128 return None 130 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698