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

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: Cleanup, deleted unused files/import 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..4194a6131d3958a81e2afc58a68e9192c641e273 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 initialized DataSources. DataSources are
+ initialized with |server_instance| and |request|. If the DataSources are
+ going to be used for Cron, |request| should be omitted.
+
+ 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
« no previous file with comments | « chrome/common/extensions/docs/server2/data_source.py ('k') | chrome/common/extensions/docs/server2/manifest_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698