OLD | NEW |
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_data_source import APIDataSource |
6 from api_list_data_source import APIListDataSource | 6 from api_list_data_source import APIListDataSource |
7 from data_source import DataSource | 7 from data_source import DataSource |
8 from manifest_data_source import ManifestDataSource | 8 from manifest_data_source import ManifestDataSource |
9 from permissions_data_source import PermissionsDataSource | 9 from permissions_data_source import PermissionsDataSource |
| 10 from samples_data_source import SamplesDataSource |
10 from sidenav_data_source import SidenavDataSource | 11 from sidenav_data_source import SidenavDataSource |
11 from strings_data_source import StringsDataSource | 12 from strings_data_source import StringsDataSource |
12 from template_data_source import ( | 13 from template_data_source import ( |
13 ArticleDataSource, IntroDataSource, PartialDataSource) | 14 ArticleDataSource, IntroDataSource, PartialDataSource) |
14 from whats_new_data_source import WhatsNewDataSource | 15 from whats_new_data_source import WhatsNewDataSource |
15 | 16 |
16 | 17 |
17 _all_data_sources = { | 18 _all_data_sources = { |
18 'apis': APIDataSource, | 19 'apis': APIDataSource, |
19 'api_list': APIListDataSource, | 20 'api_list': APIListDataSource, |
20 'articles': ArticleDataSource, | 21 'articles': ArticleDataSource, |
21 'intros': IntroDataSource, | 22 'intros': IntroDataSource, |
22 'manifest_source': ManifestDataSource, | 23 'manifest_source': ManifestDataSource, |
23 'partials': PartialDataSource, | 24 'partials': PartialDataSource, |
24 'permissions': PermissionsDataSource, | 25 'permissions': PermissionsDataSource, |
| 26 'samples': SamplesDataSource, |
25 'sidenavs': SidenavDataSource, | 27 'sidenavs': SidenavDataSource, |
26 'strings': StringsDataSource, | 28 'strings': StringsDataSource, |
27 'whatsNew' : WhatsNewDataSource | 29 'whatsNew' : WhatsNewDataSource |
28 } | 30 } |
29 | 31 |
30 assert all(issubclass(cls, DataSource) | 32 assert all(issubclass(cls, DataSource) |
31 for cls in _all_data_sources.itervalues()) | 33 for cls in _all_data_sources.itervalues()) |
32 | 34 |
33 def CreateDataSources(server_instance, request=None): | 35 def CreateDataSources(server_instance, request=None): |
34 '''Create a dictionary of initialized DataSources. DataSources are | 36 '''Create a dictionary of initialized DataSources. DataSources are |
35 initialized with |server_instance| and |request|. If the DataSources are | 37 initialized with |server_instance| and |request|. If the DataSources are |
36 going to be used for Cron, |request| should be omitted. | 38 going to be used for Cron, |request| should be omitted. |
37 | 39 |
38 The key of each DataSource is the name the template system will use to access | 40 The key of each DataSource is the name the template system will use to access |
39 the DataSource. | 41 the DataSource. |
40 ''' | 42 ''' |
41 return dict((name, cls(server_instance, request)) | 43 return dict((name, cls(server_instance, request)) |
42 for name, cls in _all_data_sources.iteritems()) | 44 for name, cls in _all_data_sources.iteritems()) |
OLD | NEW |