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

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

Issue 10830252: Extensions Docs Server: Uniform handling of file not found errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 third_party.handlebar import Handlebar 9 from third_party.handlebar import Handlebar
9 10
10 EXTENSIONS_URL = '/chrome/extensions' 11 EXTENSIONS_URL = '/chrome/extensions'
11 12
12 def _MakeBranchDict(branch): 13 def _MakeBranchDict(branch):
13 return { 14 return {
14 'showWarning': branch != 'stable', 15 'showWarning': branch != 'stable',
15 'branches': [ 16 'branches': [
16 { 'name': 'Stable', 'path': 'stable' }, 17 { 'name': 'Stable', 'path': 'stable' },
17 { 'name': 'Dev', 'path': 'dev' }, 18 { 'name': 'Dev', 'path': 'dev' },
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 def __getitem__(self, key): 119 def __getitem__(self, key):
119 return self.get(key) 120 return self.get(key)
120 121
121 def get(self, key): 122 def get(self, key):
122 return self.GetTemplate(self._private_template_path, key) 123 return self.GetTemplate(self._private_template_path, key)
123 124
124 def GetTemplate(self, base_path, template_name): 125 def GetTemplate(self, base_path, template_name):
125 real_path = FormatKey(template_name) 126 real_path = FormatKey(template_name)
126 try: 127 try:
127 return self._cache.GetFromFile(base_path + '/' + real_path) 128 return self._cache.GetFromFile(base_path + '/' + real_path)
128 except Exception as e: 129 except FileNotFoundError as e:
129 logging.error(e) 130 logging.error(e)
130 return None 131 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698