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

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

Issue 575613003: Docserver: Gitiles auth and cron refactoring. (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 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 2e4e794d3137cd38b8c6a032abb9171c4a3adb12..43161e320854ed10e8fc3b24767201608ab73462 100644
--- a/chrome/common/extensions/docs/server2/data_source_registry.py
+++ b/chrome/common/extensions/docs/server2/data_source_registry.py
@@ -31,13 +31,25 @@ _all_data_sources = {
'whatsNew' : WhatsNewDataSource
}
+
assert all(issubclass(cls, DataSource)
for cls in _all_data_sources.itervalues())
+
+def GetDataSourceNames():
+ return _all_data_sources.keys()
+
+
+def CreateDataSource(name, server_instance, request=None):
+ '''Create a single DataSource by name.'''
+ assert name in _all_data_sources
+ return _all_data_sources[name](server_instance, request)
+
+
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.
+ going to be used for Refresh, |request| should be omitted.
The key of each DataSource is the name the template system will use to access
the DataSource.
« no previous file with comments | « chrome/common/extensions/docs/server2/data_source.py ('k') | chrome/common/extensions/docs/server2/fake_fetchers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698