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

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

Issue 63203002: Docserver: Make the hand-written Cron methods run first rather than last, since (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 1 month 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 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 from data_source import DataSource 5 from data_source import DataSource
6 6
7 class StringsDataSource(DataSource): 7 class StringsDataSource(DataSource):
8 '''Provides templates with access to a key to string mapping defined in a 8 '''Provides templates with access to a key to string mapping defined in a
9 JSON configuration file. 9 JSON configuration file.
10 ''' 10 '''
11 def __init__(self, server_instance, _): 11 def __init__(self, server_instance, _):
12 self._cache = server_instance.compiled_fs_factory.ForJson( 12 self._cache = server_instance.compiled_fs_factory.ForJson(
13 server_instance.host_file_system_provider.GetTrunk()) 13 server_instance.host_file_system_provider.GetTrunk())
14 self._strings_json_path = server_instance.strings_json_path 14 self._strings_json_path = server_instance.strings_json_path
15 15
16 def _GetStringsData(self):
17 return self._cache.GetFromFile(self._strings_json_path)
18
16 def Cron(self): 19 def Cron(self):
17 self._cache.GetFromFile(self._strings_json_path).Get() 20 return self._GetStringsData()
18 21
19 def get(self, key): 22 def get(self, key):
20 return self._cache.GetFromFile(self._strings_json_path).Get()[key] 23 return self._GetStringsData().Get().get(key)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698