1 # |
|
2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net> |
|
3 # All Rights Reserved. |
|
4 # |
|
5 # This software is subject to the provisions of the Zope Public License, |
|
6 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
|
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
|
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
|
10 # FOR A PARTICULAR PURPOSE. |
|
11 # |
|
12 |
|
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 |
|
16 # import standard library |
|
17 |
|
18 # import interfaces |
|
19 from zope.contentprovider.interfaces import IContentProvider |
|
20 from zope.interface.common.mapping import IReadMapping |
|
21 |
|
22 # import packages |
|
23 from zope.interface import Attribute |
|
24 |
|
25 |
|
26 class IViewlet(IContentProvider): |
|
27 """A content provider that is managed by another content provider, known |
|
28 as viewlet manager. |
|
29 |
|
30 Note that you *cannot* call viewlets directly as a provider, i.e. through |
|
31 the TALES ``provider`` expression, since it always has to know its manager. |
|
32 """ |
|
33 |
|
34 manager = Attribute("""The Viewlet Manager |
|
35 |
|
36 The viewlet manager for which the viewlet is registered. The viewlet |
|
37 manager will contain any additional data that was provided by the |
|
38 view, for example the TAL namespace attributes. |
|
39 """) |
|
40 |
|
41 |
|
42 class IViewletManager(IContentProvider, IReadMapping): |
|
43 """A component that provides access to the content providers. |
|
44 |
|
45 The viewlet manager's responsibilities are: |
|
46 |
|
47 (1) Aggregation of all viewlets registered for the manager. |
|
48 |
|
49 (2) Apply a set of filters to determine the availability of the |
|
50 viewlets. |
|
51 |
|
52 (3) Sort the viewlets based on some implemented policy. |
|
53 |
|
54 (4) Provide an environment in which the viewlets are rendered. |
|
55 |
|
56 (5) Render itself containing the HTML content of the viewlets. |
|
57 """ |
|