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

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

Issue 491653002: Docserver: Use GitilesFileSystem instead of SubversionFileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 extensions_paths import JSON_TEMPLATES 7 from extensions_paths import JSON_TEMPLATES
8 from data_source import DataSource 8 from data_source import DataSource
9 9
10 10
11 class StringsDataSource(DataSource): 11 class StringsDataSource(DataSource):
12 '''Provides templates with access to a key to string mapping defined in a 12 '''Provides templates with access to a key to string mapping defined in a
13 JSON configuration file. 13 JSON configuration file.
14 ''' 14 '''
15 def __init__(self, server_instance, _): 15 def __init__(self, server_instance, _):
16 self._cache = server_instance.compiled_fs_factory.ForJson( 16 self._cache = server_instance.compiled_fs_factory.ForJson(
17 server_instance.host_file_system_provider.GetTrunk()) 17 server_instance.host_file_system_provider.GetMaster())
18 18
19 def _GetStringsData(self): 19 def _GetStringsData(self):
20 return self._cache.GetFromFile('%sstrings.json' % JSON_TEMPLATES) 20 return self._cache.GetFromFile('%sstrings.json' % JSON_TEMPLATES)
21 21
22 def Cron(self): 22 def Cron(self):
23 return self._GetStringsData() 23 return self._GetStringsData()
24 24
25 def get(self, key): 25 def get(self, key):
26 string = self._GetStringsData().Get().get(key) 26 string = self._GetStringsData().Get().get(key)
27 if string is None: 27 if string is None:
28 logging.warning('String "%s" not found' % key) 28 logging.warning('String "%s" not found' % key)
29 return string 29 return string
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698