8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 from persistent import Persistent |
13 from persistent import Persistent |
|
14 from pyams_cache.beaker import get_cache |
16 from pyramid.events import subscriber |
15 from pyramid.events import subscriber |
17 from zope.lifecycleevent.interfaces import IObjectModifiedEvent |
16 from zope.lifecycleevent.interfaces import IObjectModifiedEvent |
18 from zope.location import Location |
17 from zope.location import Location |
19 from zope.schema.fieldproperty import FieldProperty |
18 from zope.schema.fieldproperty import FieldProperty |
20 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary |
19 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary |
21 from zope.traversing.interfaces import ITraversable |
20 from zope.traversing.interfaces import ITraversable |
22 |
21 |
23 from pyams_cache.beaker import get_cache |
|
24 from pyams_content.features.footer.interfaces import FOOTER_RENDERERS, FOOTER_RENDERER_SETTINGS_KEY, \ |
22 from pyams_content.features.footer.interfaces import FOOTER_RENDERERS, FOOTER_RENDERER_SETTINGS_KEY, \ |
25 FOOTER_SETTINGS_KEY, IFooterRenderer, IFooterRendererSettings, IFooterSettings, IFooterTarget |
23 FOOTER_SETTINGS_KEY, IFooterRenderer, IFooterRendererSettings, IFooterSettings, IFooterTarget |
26 from pyams_content.features.renderer import RenderedContentMixin |
24 from pyams_content.features.renderer import RenderedContentMixin |
|
25 from pyams_form.interfaces.form import IFormContextPermissionChecker |
|
26 from pyams_portal.interfaces import MANAGE_TEMPLATE_PERMISSION |
27 from pyams_portal.portlet import PORTLETS_CACHE_NAME, PORTLETS_CACHE_REGION |
27 from pyams_portal.portlet import PORTLETS_CACHE_NAME, PORTLETS_CACHE_REGION |
28 from pyams_utils.adapter import ContextAdapter, adapter_config, get_annotation_adapter |
28 from pyams_utils.adapter import ContextAdapter, adapter_config, get_annotation_adapter |
29 from pyams_utils.factory import factory_config |
29 from pyams_utils.factory import factory_config |
30 from pyams_utils.inherit import BaseInheritInfo, InheritedFieldProperty |
30 from pyams_utils.inherit import BaseInheritInfo, InheritedFieldProperty |
31 from pyams_utils.request import check_request |
31 from pyams_utils.request import check_request |
32 from pyams_utils.traversing import get_parent |
32 from pyams_utils.traversing import get_parent |
33 from pyams_utils.vocabulary import vocabulary_config |
33 from pyams_utils.vocabulary import vocabulary_config |
|
34 |
|
35 |
|
36 __docformat__ = 'restructuredtext' |
34 |
37 |
35 |
38 |
36 @factory_config(IFooterSettings) |
39 @factory_config(IFooterSettings) |
37 class FooterSettings(BaseInheritInfo, RenderedContentMixin, Persistent, Location): |
40 class FooterSettings(BaseInheritInfo, RenderedContentMixin, Persistent, Location): |
38 """Footer settings persistent class""" |
41 """Footer settings persistent class""" |
115 """Footer target renderer settings factory""" |
118 """Footer target renderer settings factory""" |
116 settings = IFooterSettings(context) |
119 settings = IFooterSettings(context) |
117 return IFooterRendererSettings(settings, None) |
120 return IFooterRendererSettings(settings, None) |
118 |
121 |
119 |
122 |
|
123 @adapter_config(context=IFooterRendererSettings, provides=IFormContextPermissionChecker) |
|
124 class FooterRendererSettingsPermissionChecker(ContextAdapter): |
|
125 """Footer renderer settings permission checker""" |
|
126 |
|
127 edit_permission = MANAGE_TEMPLATE_PERMISSION |
|
128 |
|
129 |
120 @vocabulary_config(name=FOOTER_RENDERERS) |
130 @vocabulary_config(name=FOOTER_RENDERERS) |
121 class FooterRendererVocabulary(SimpleVocabulary): |
131 class FooterRendererVocabulary(SimpleVocabulary): |
122 """Footer renderers vocabulary""" |
132 """Footer renderers vocabulary""" |
123 |
133 |
124 def __init__(self, context=None): |
134 def __init__(self, context=None): |