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

Unified Diff: chrome/common/extensions/docs/server2/data_source_registry.py

Issue 22824042: Docserver: SidenavDataSource refactor, transition to DataSourceRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/data_source_registry.py
diff --git a/chrome/common/extensions/docs/server2/data_source_registry.py b/chrome/common/extensions/docs/server2/data_source_registry.py
index 703fc22f392c2819688a4502f1ceb0b6bd15804d..eb79e76fe28dc869d9ff87c6e99ac360458ef30c 100644
--- a/chrome/common/extensions/docs/server2/data_source_registry.py
+++ b/chrome/common/extensions/docs/server2/data_source_registry.py
@@ -3,17 +3,25 @@
# found in the LICENSE file.
from manifest_data_source import ManifestDataSource
+from sidenav_data_source import SidenavDataSource
from strings_data_source import StringsDataSource
_all_data_sources = {
'manifest_source': ManifestDataSource,
+ 'sidenavs': SidenavDataSource,
'strings': StringsDataSource
}
-def CreateDataSources(server_instance):
- '''Yields tuples of a name and an instantiated DataSource. The name is the
- string that templates use to access the DataSource. Each DataSource is
- initialized with |server_instance|.
+def CreateDataSources(server_instance, request=None):
+ '''Create a dictionary of initalized DataSources. DataSources are initalized
+ with |server_instance| and |request|. If the DataSources are going to be used
+ for Cron, |request| should be ommitted.
Jeffrey Yasskin 2013/08/28 19:12:37 sp: ommitted -> omitted
jshumway 2013/08/29 00:13:09 Done.
+
+ The key of each DataSource is the name the template system will use to access
+ the DataSource.
'''
- return dict(
- (name, cls(server_instance)) for name, cls in _all_data_sources.iteritems())
+ data_sources = {}
+ for name, cls in _all_data_sources.iteritems():
+ data_sources[name] = cls(server_instance, request)
+
+ return data_sources

Powered by Google App Engine
This is Rietveld 408576698