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

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

Issue 228723005: Refactor APIDataSource to work with DataSourceRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tiny cleanup Created 6 years, 8 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 api_data_source import APIDataSource
5 from api_list_data_source import APIListDataSource 6 from api_list_data_source import APIListDataSource
6 from data_source import DataSource 7 from data_source import DataSource
7 from manifest_data_source import ManifestDataSource 8 from manifest_data_source import ManifestDataSource
8 from permissions_data_source import PermissionsDataSource 9 from permissions_data_source import PermissionsDataSource
9 from sidenav_data_source import SidenavDataSource 10 from sidenav_data_source import SidenavDataSource
10 from strings_data_source import StringsDataSource 11 from strings_data_source import StringsDataSource
11 from template_data_source import ( 12 from template_data_source import (
12 ArticleDataSource, IntroDataSource, PartialDataSource) 13 ArticleDataSource, IntroDataSource, PartialDataSource)
13 from whats_new_data_source import WhatsNewDataSource 14 from whats_new_data_source import WhatsNewDataSource
14 15
15 16
16 _all_data_sources = { 17 _all_data_sources = {
18 'apis': APIDataSource,
17 'api_list': APIListDataSource, 19 'api_list': APIListDataSource,
18 'articles': ArticleDataSource, 20 'articles': ArticleDataSource,
19 'intros': IntroDataSource, 21 'intros': IntroDataSource,
20 'manifest_source': ManifestDataSource, 22 'manifest_source': ManifestDataSource,
21 'partials': PartialDataSource, 23 'partials': PartialDataSource,
22 'permissions': PermissionsDataSource, 24 'permissions': PermissionsDataSource,
23 'sidenavs': SidenavDataSource, 25 'sidenavs': SidenavDataSource,
24 'strings': StringsDataSource, 26 'strings': StringsDataSource,
25 'whatsNew' : WhatsNewDataSource 27 'whatsNew' : WhatsNewDataSource
26 } 28 }
27 29
28 assert all(issubclass(cls, DataSource) 30 assert all(issubclass(cls, DataSource)
29 for cls in _all_data_sources.itervalues()) 31 for cls in _all_data_sources.itervalues())
30 32
31 def CreateDataSources(server_instance, request=None): 33 def CreateDataSources(server_instance, request=None):
32 '''Create a dictionary of initialized DataSources. DataSources are 34 '''Create a dictionary of initialized DataSources. DataSources are
33 initialized with |server_instance| and |request|. If the DataSources are 35 initialized with |server_instance| and |request|. If the DataSources are
34 going to be used for Cron, |request| should be omitted. 36 going to be used for Cron, |request| should be omitted.
35 37
36 The key of each DataSource is the name the template system will use to access 38 The key of each DataSource is the name the template system will use to access
37 the DataSource. 39 the DataSource.
38 ''' 40 '''
39 return dict((name, cls(server_instance, request)) 41 return dict((name, cls(server_instance, request))
40 for name, cls in _all_data_sources.iteritems()) 42 for name, cls in _all_data_sources.iteritems())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698