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

Side by Side 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, 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 from manifest_data_source import ManifestDataSource 5 from manifest_data_source import ManifestDataSource
6 from sidenav_data_source import SidenavDataSource
6 from strings_data_source import StringsDataSource 7 from strings_data_source import StringsDataSource
7 8
8 _all_data_sources = { 9 _all_data_sources = {
9 'manifest_source': ManifestDataSource, 10 'manifest_source': ManifestDataSource,
11 'sidenavs': SidenavDataSource,
10 'strings': StringsDataSource 12 'strings': StringsDataSource
11 } 13 }
12 14
13 def CreateDataSources(server_instance): 15 def CreateDataSources(server_instance, request=None):
14 '''Yields tuples of a name and an instantiated DataSource. The name is the 16 '''Create a dictionary of initalized DataSources. DataSources are initalized
15 string that templates use to access the DataSource. Each DataSource is 17 with |server_instance| and |request|. If the DataSources are going to be used
16 initialized with |server_instance|. 18 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.
19
20 The key of each DataSource is the name the template system will use to access
21 the DataSource.
17 ''' 22 '''
18 return dict( 23 data_sources = {}
19 (name, cls(server_instance)) for name, cls in _all_data_sources.iteritems()) 24 for name, cls in _all_data_sources.iteritems():
25 data_sources[name] = cls(server_instance, request)
26
27 return data_sources
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698