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

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

Issue 10700118: Extensions Docs Server: First doc conversions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added all APIs 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 third_party.handlebar import Handlebar 5 from third_party.handlebar import Handlebar
6 6
7 EXTENSIONS_URL = '/chrome/extensions' 7 EXTENSIONS_URL = '/chrome/extensions'
8 8
9 class TemplateDataSource(object): 9 class TemplateDataSource(object):
10 """This class fetches and compiles templates using the fetcher passed in with 10 """This class fetches and compiles templates using the fetcher passed in with
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 'partials': self, 46 'partials': self,
47 }).text 47 }).text
48 48
49 def __getitem__(self, key): 49 def __getitem__(self, key):
50 return self.get(key) 50 return self.get(key)
51 51
52 def get(self, key): 52 def get(self, key):
53 index = key.rfind('.html') 53 index = key.rfind('.html')
54 if index > 0: 54 if index > 0:
55 key = key[:index] 55 key = key[:index]
56 real_path = key + '.html' 56 safe_key = key.replace('.', '_')
57 real_path = safe_key + '.html'
57 for base_path in self._base_paths: 58 for base_path in self._base_paths:
58 try: 59 try:
59 return self._cache.get(base_path + '/' + real_path) 60 return self._cache.get(base_path + '/' + real_path)
60 except: 61 except:
61 pass 62 pass
62 return None 63 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698