| Index: chrome/common/extensions/docs/server2/template_data_source.py
|
| diff --git a/chrome/common/extensions/docs/server2/template_data_source.py b/chrome/common/extensions/docs/server2/template_data_source.py
|
| index 984f82af2992a47691cc61da10ecaf630cb6dc4b..858e318da36f7761d108737b3f38349fee31dcbd 100644
|
| --- a/chrome/common/extensions/docs/server2/template_data_source.py
|
| +++ b/chrome/common/extensions/docs/server2/template_data_source.py
|
| @@ -2,6 +2,7 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| +import logging
|
| from path_utils import FormatKey
|
| from third_party.handlebar import Handlebar
|
|
|
| @@ -26,6 +27,7 @@ class TemplateDataSource(object):
|
| self._samples_data_source = samples_data_source
|
| self._cache = cache_builder.build(self._LoadTemplate)
|
| self._base_paths = base_paths
|
| + self._use = 0
|
|
|
| def _MakeBranchDict(self, branch):
|
| return {
|
| @@ -47,10 +49,12 @@ class TemplateDataSource(object):
|
| the partial templates needed from |self._cache|. Partials are retrieved
|
| from the TemplateDataSource with the |get| method.
|
| """
|
| + self._use = 0
|
| template = self.get(template_name)
|
| if not template:
|
| return ''
|
| # TODO error handling
|
| + self._use = 1
|
| return template.render({
|
| 'apis': self._api_data_source,
|
| 'branchInfo': self._branch_info,
|
| @@ -65,9 +69,9 @@ class TemplateDataSource(object):
|
|
|
| def get(self, key):
|
| real_path = FormatKey(key)
|
| - for base_path in self._base_paths:
|
| - try:
|
| - return self._cache.getFromFile(base_path + '/' + real_path)
|
| - except:
|
| - pass
|
| - return None
|
| + try:
|
| + return self._cache.getFromFile(
|
| + self._base_paths[self._use] + '/' + real_path)
|
| + except Exception as e:
|
| + logging.warn(e)
|
| + return None
|
|
|