|
1 # |
|
2 # Copyright (c) 2008-2018 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 pyams_content.features.header.interfaces import IHeaderTarget, IHeaderSettings |
|
20 from pyams_default_theme.features.header.interfaces import ISimpleHeaderRendererSettings |
|
21 from pyams_skin.layer import IPyAMSUserLayer |
|
22 |
|
23 # import packages |
|
24 from pyams_template.template import template_config |
|
25 from pyams_utils.traversing import get_parent |
|
26 from pyams_viewlet.viewlet import contentprovider_config, ViewContentProvider |
|
27 from zope.interface import Interface |
|
28 |
|
29 |
|
30 @contentprovider_config(name='pyams.banner', layer=IPyAMSUserLayer, view=Interface) |
|
31 @template_config(template='templates/banner.pt', layer=IPyAMSUserLayer) |
|
32 class Banner(ViewContentProvider): |
|
33 """Banner content provider""" |
|
34 |
|
35 @property |
|
36 def settings(self): |
|
37 target = get_parent(self.context, IHeaderTarget) |
|
38 return ISimpleHeaderRendererSettings(IHeaderSettings(target).settings, None) |