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