# HG changeset patch # User Thierry Florac # Date 1526626104 -7200 # Node ID 1264ca1778e42222fff62ddcadd286079e20bb4d # Parent e908c952d5c993bb953b6f09c0e20adb7de32128 Reorganized PyAMS_content features modules diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/association/__init__.py --- a/src/pyams_default_theme/component/association/__init__.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/association/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -22,7 +22,7 @@ from pyams_skin.layer import IPyAMSLayer # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/gallery/__init__.py --- a/src/pyams_default_theme/component/gallery/__init__.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/gallery/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -21,7 +21,7 @@ from pyams_skin.layer import IPyAMSLayer # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/illustration/__init__.py --- a/src/pyams_default_theme/component/illustration/__init__.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/illustration/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -21,12 +21,11 @@ from pyams_content.features.renderer.interfaces import IContentRenderer from pyams_default_theme.component.illustration.interfaces import IIllustrationWithZoomSettings from pyams_skin.layer import IPyAMSLayer -from zope.annotation.interfaces import IAnnotations # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config -from pyams_utils.adapter import adapter_config +from pyams_utils.adapter import adapter_config, get_annotation_adapter from zope.interface import implementer from zope.location import locate, Location from zope.schema.fieldproperty import FieldProperty @@ -51,12 +50,7 @@ @adapter_config(context=IIllustration, provides=IIllustrationWithZoomSettings) def illustration_with_zoom_settings_factory(context): """Illustration zoom renderer settings factory""" - annotations = IAnnotations(context) - settings = annotations.get(ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY) - if settings is None: - settings = annotations[ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY] = IllustrationZoomSettings() - locate(settings, context) - return settings + return get_annotation_adapter(context, ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY, IllustrationZoomSettings) # diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/contact.py --- a/src/pyams_default_theme/component/paragraph/contact.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/contact.py Fri May 18 08:48:24 2018 +0200 @@ -21,12 +21,11 @@ from pyams_content.features.renderer.interfaces import IContentRenderer from pyams_default_theme.component.paragraph.interfaces.contact import IContactParagraphDefaultRendererSettings from pyams_skin.layer import IPyAMSLayer -from zope.annotation.interfaces import IAnnotations # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config -from pyams_utils.adapter import adapter_config +from pyams_utils.adapter import adapter_config, get_annotation_adapter from zope.interface import implementer from zope.location import locate, Location from zope.schema.fieldproperty import FieldProperty @@ -70,12 +69,8 @@ @adapter_config(context=IContactParagraph, provides=IContactParagraphDefaultRendererSettings) def contact_paragraph_default_renderer_settings_factory(context): """Contact paragraph default renderer settings factory""" - annotations = IAnnotations(context) - settings = annotations.get(CONTACT_DEFAULT_RENDERER_SETTINGS_KEY) - if settings is None: - settings = annotations[CONTACT_DEFAULT_RENDERER_SETTINGS_KEY] = ContactParagraphDefaultRendererSettings() - locate(settings, context) - return settings + return get_annotation_adapter(context, CONTACT_DEFAULT_RENDERER_SETTINGS_KEY, + ContactParagraphDefaultRendererSettings) # diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/frame.py --- a/src/pyams_default_theme/component/paragraph/frame.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/frame.py Fri May 18 08:48:24 2018 +0200 @@ -25,12 +25,11 @@ ILateralFrameParagraphRendererSettings, IDefaultFrameParagraphRendererSettings from pyams_i18n.interfaces import II18n from pyams_skin.layer import IPyAMSLayer -from zope.annotation.interfaces import IAnnotations # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config -from pyams_utils.adapter import adapter_config +from pyams_utils.adapter import adapter_config, get_annotation_adapter from zope.interface import implementer from zope.location import locate, Location from zope.schema.fieldproperty import FieldProperty @@ -75,12 +74,8 @@ @adapter_config(context=IFrameParagraph, provides=IDefaultFrameParagraphRendererSettings) def default_frame_paragraph_renderer_settings_factory(context): """Frame paragraph default renderer settings factory""" - annotations = IAnnotations(context) - settings = annotations.get(FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY) - if settings is None: - settings = annotations[FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY] = DefaultFrameParagraphRendererSettings() - locate(settings, context) - return settings + return get_annotation_adapter(context, FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY, + DefaultFrameParagraphRendererSettings) @implementer(ILateralFrameParagraphRendererSettings) @@ -96,12 +91,8 @@ @adapter_config(context=IFrameParagraph, provides=ILateralFrameParagraphRendererSettings) def lateral_frame_paragraph_renderer_settings_factory(context): """Frame text paragraph lateral renderer settings factory""" - annotations = IAnnotations(context) - settings = annotations.get(LATERAL_FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY) - if settings is None: - settings = annotations[LATERAL_FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY] = LateralFrameParagraphRendererSettings() - locate(settings, context) - return settings + return get_annotation_adapter(context, LATERAL_FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY, + LateralFrameParagraphRendererSettings) # diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/header.py --- a/src/pyams_default_theme/component/paragraph/header.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/header.py Fri May 18 08:48:24 2018 +0200 @@ -21,7 +21,7 @@ from pyams_skin.layer import IPyAMSLayer # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/keypoint.py --- a/src/pyams_default_theme/component/paragraph/keypoint.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/keypoint.py Fri May 18 08:48:24 2018 +0200 @@ -21,7 +21,7 @@ from pyams_skin.layer import IPyAMSLayer # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/templates/contact-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/contact-default.pt Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/contact-default.pt Fri May 18 08:48:24 2018 +0200 @@ -1,4 +1,4 @@ -

Contact title

Title

Title

diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/templates/frame-right.pt --- a/src/pyams_default_theme/component/paragraph/templates/frame-right.pt Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/frame-right.pt Fri May 18 08:48:24 2018 +0200 @@ -1,4 +1,4 @@ -

Title

diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt Fri May 18 08:48:24 2018 +0200 @@ -1,4 +1,4 @@ -
diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt Fri May 18 08:48:24 2018 +0200 @@ -1,4 +1,4 @@ -

Title

diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt Fri May 18 08:48:24 2018 +0200 @@ -1,4 +1,4 @@ -

Title

diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/verbatim.py --- a/src/pyams_default_theme/component/paragraph/verbatim.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/verbatim.py Fri May 18 08:48:24 2018 +0200 @@ -17,7 +17,6 @@ from persistent import Persistent # import interfaces -from pyams_content.component.association.interfaces import IAssociationContainer from pyams_content.component.illustration.interfaces import IIllustration from pyams_content.component.paragraph.interfaces.verbatim import IVerbatimParagraph from pyams_content.features.renderer.interfaces import IContentRenderer @@ -25,12 +24,11 @@ ILateralVerbatimParagraphRendererSettings, IDefaultVerbatimParagraphRendererSettings from pyams_i18n.interfaces import II18n from pyams_skin.layer import IPyAMSLayer -from zope.annotation.interfaces import IAnnotations # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config -from pyams_utils.adapter import adapter_config +from pyams_utils.adapter import adapter_config, get_annotation_adapter from zope.interface import implementer from zope.location import locate, Location from zope.schema.fieldproperty import FieldProperty @@ -67,12 +65,8 @@ @adapter_config(context=IVerbatimParagraph, provides=IDefaultVerbatimParagraphRendererSettings) def default_verbatim_paragraph_renderer_settings_factory(context): """Frame paragraph default renderer settings factory""" - annotations = IAnnotations(context) - settings = annotations.get(VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY) - if settings is None: - settings = annotations[VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY] = DefaultVerbatimParagraphRendererSettings() - locate(settings, context) - return settings + return get_annotation_adapter(context, VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY, + DefaultVerbatimParagraphRendererSettings) @implementer(ILateralVerbatimParagraphRendererSettings) @@ -88,13 +82,8 @@ @adapter_config(context=IVerbatimParagraph, provides=ILateralVerbatimParagraphRendererSettings) def lateral_verbatim_paragraph_renderer_settings_factory(context): """Frame text paragraph lateral renderer settings factory""" - annotations = IAnnotations(context) - settings = annotations.get(LATERAL_VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY) - if settings is None: - settings = annotations[LATERAL_VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY] = \ - LateralVerbatimParagraphRendererSettings() - locate(settings, context) - return settings + return get_annotation_adapter(context, LATERAL_VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY, + LateralVerbatimParagraphRendererSettings) # diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/paragraph/video.py --- a/src/pyams_default_theme/component/paragraph/video.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/video.py Fri May 18 08:48:24 2018 +0200 @@ -21,7 +21,7 @@ from pyams_skin.layer import IPyAMSLayer # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/component/video/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/component/video/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces + +# import packages diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/common.py --- a/src/pyams_default_theme/shared/common.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/shared/common.py Fri May 18 08:48:24 2018 +0200 @@ -21,7 +21,7 @@ from pyams_default_theme.layer import IPyAMSDefaultLayer # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/imagemap/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/imagemap/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.component.association.interfaces import IAssociationInfo +from pyams_content.component.paragraph.interfaces import IParagraphRenderer +from pyams_content.features.renderer.interfaces import IContentRenderer +from pyams_content.shared.imagemap.interfaces import IWfImageMap, IImageMapParagraph +from pyams_i18n.interfaces import II18n +from pyams_skin.layer import IPyAMSLayer + +# import packages +from pyams_content.features.renderer.skin import BaseContentRenderer +from pyams_template.template import template_config +from pyams_utils.adapter import adapter_config +from pyams_viewlet.viewlet import BaseContentProvider + + +# +# Imagemap renderer +# + +@adapter_config(name='imagemap-render', context=(IWfImageMap, IPyAMSLayer), provides=IContentRenderer) +@template_config(template='templates/render.pt', layer=IPyAMSLayer) +class ImagemapRenderer(BaseContentRenderer): + """Image map renderer""" + + weight = 20 + + def get_item_info(self, item): + return IAssociationInfo(item, None) + + +# +# Imagemap paragraph renderer +# + +@adapter_config(context=(IImageMapParagraph, IPyAMSLayer), provides=IParagraphRenderer) +@template_config(template='templates/paragraph-render.pt', layer=IPyAMSLayer) +class ImagemapParagraphRenderer(BaseContentProvider): + """Image map paragraph renderer""" + + language = None + + def update(self): + i18n = II18n(self.context) + if self.language: + setattr(self, 'title', i18n.get_attribute('title', self.language, request=self.request)) + else: + setattr(self, 'title', i18n.query_attribute('title', request=self.request)) + + def get_item_info(self, item): + return IAssociationInfo(item, None) diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/imagemap/templates/paragraph-render.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/imagemap/templates/paragraph-render.pt Fri May 18 08:48:24 2018 +0200 @@ -0,0 +1,27 @@ +

title

+
+ + + + + + + + +
diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/imagemap/templates/render.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/imagemap/templates/render.pt Fri May 18 08:48:24 2018 +0200 @@ -0,0 +1,23 @@ +
+ + + + + + + + +
diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/logo/__init__.py --- a/src/pyams_default_theme/shared/logo/__init__.py Fri May 18 08:47:41 2018 +0200 +++ b/src/pyams_default_theme/shared/logo/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -20,7 +20,7 @@ from pyams_skin.layer import IPyAMSLayer # import packages -from pyams_content.features.renderer.zmi import BaseContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/view/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/view/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces + +# import packages diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/view/portlet/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/view/portlet/__init__.py Fri May 18 08:48:24 2018 +0200 @@ -0,0 +1,37 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.shared.view.portlet.interfaces import IViewItemsPortletSettings +from pyams_portal.interfaces import IPortalContext, IPortletRenderer +from pyams_skin.layer import IPyAMSLayer + +# import packages +from pyams_portal.portlet import PortletRenderer +from pyams_template.template import template_config +from pyams_utils.adapter import adapter_config +from zope.interface import Interface + +from pyams_default_theme import _ + + +@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IViewItemsPortletSettings), provides=IPortletRenderer) +@template_config(template='templates/view-items-list.pt', layer=IPyAMSLayer) +class ViewItemsPortletRenderer(PortletRenderer): + """View items portlet renderer""" + + label = _("Simple list view") diff -r e908c952d5c9 -r 1264ca1778e4 src/pyams_default_theme/shared/view/portlet/templates/view-items-list.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/view/portlet/templates/view-items-list.pt Fri May 18 08:48:24 2018 +0200 @@ -0,0 +1,3 @@ +
+ +