--- a/src/pyams_default_theme/component/illustration/__init__.py Fri Oct 04 13:45:34 2019 +0200
+++ b/src/pyams_default_theme/component/illustration/__init__.py Fri Oct 04 19:08:38 2019 +0200
@@ -10,23 +10,22 @@
# FOR A PARTICULAR PURPOSE.
#
-__docformat__ = 'restructuredtext'
-
from persistent import Persistent
from zope.interface import Interface, implementer
from zope.location import Location
from zope.schema.fieldproperty import FieldProperty
-from pyams_content.component.illustration import IBasicIllustrationTarget, ILinkIllustration, ILinkIllustrationTarget
+from pyams_content.component.illustration import IBasicIllustrationTarget, ILinkIllustration, \
+ ILinkIllustrationTarget
from pyams_content.component.illustration.interfaces import IIllustration
from pyams_content.component.links import IInternalLink
-from pyams_content.features.renderer.interfaces import IContentRenderer
+from pyams_content.features.renderer.interfaces import HIDDEN_RENDERER_NAME, IContentRenderer
from pyams_content.interfaces import IBaseContent
from pyams_content.root import ISiteRoot
from pyams_content.shared.common import ISharedContent
from pyams_default_theme import lightbox
-from pyams_default_theme.component.illustration.interfaces import IIllustrationRenderer, IIllustrationWithZoomSettings, \
- ILLUSTRATION_AFTER_BODY, ILLUSTRATION_BEFORE_BODY
+from pyams_default_theme.component.illustration.interfaces import IIllustrationRenderer, \
+ IIllustrationWithZoomSettings, ILLUSTRATION_AFTER_BODY, ILLUSTRATION_BEFORE_BODY
from pyams_default_theme.features.renderer import BaseContentRenderer
from pyams_default_theme.interfaces import IContentBannerIllustration, IContentHeaderIllustration, \
IContentNavigationIllustration
@@ -36,6 +35,9 @@
from pyams_utils.factory import factory_config
from pyams_utils.interfaces.tales import ITALESExtension
+
+__docformat__ = 'restructuredtext'
+
from pyams_default_theme import _
@@ -44,7 +46,8 @@
#
@adapter_config(context=(IInternalLink, IPyAMSLayer), provides=IContentNavigationIllustration)
-@adapter_config(context=(IBasicIllustrationTarget, IPyAMSLayer), provides=IContentNavigationIllustration)
+@adapter_config(context=(IBasicIllustrationTarget, IPyAMSLayer),
+ provides=IContentNavigationIllustration)
def base_content_navigation_illustration_factory(context, request):
"""Default content navigation illustration adapter"""
illustration = ILinkIllustration(context, None)
@@ -66,11 +69,12 @@
def base_content_banner_illustration_factory(context, request):
"""Base content banner illustration adapter"""
illustration = IIllustration(context, None)
- if illustration and illustration.has_data():
+ if illustration and illustration.has_data() and (illustration.renderer != HIDDEN_RENDERER_NAME):
return illustration
-@adapter_config(context=(ILinkIllustrationTarget, IPyAMSLayer), provides=IContentNavigationIllustration)
+@adapter_config(context=(ILinkIllustrationTarget, IPyAMSLayer),
+ provides=IContentNavigationIllustration)
def link_content_navigation_illustration_factory(context, request):
"""Content navigation illustration adapter for basic link illustration targets"""
illustration = ILinkIllustration(context, None)
@@ -90,7 +94,8 @@
"""Shared content illustration factory"""
version = context.visible_version
if version is not None:
- return request.registry.queryMultiAdapter((version, request), IContentNavigationIllustration)
+ return request.registry.queryMultiAdapter((version, request),
+ IContentNavigationIllustration)
@adapter_config(name='pyams_illustration',
@@ -102,7 +107,8 @@
def render(self, context=None, name=''):
if context is None:
context = self.context
- return self.request.registry.queryMultiAdapter((context, self.request), IContentNavigationIllustration,
+ return self.request.registry.queryMultiAdapter((context, self.request),
+ IContentNavigationIllustration,
name=name)
@@ -115,7 +121,8 @@
def render(self, context=None, name=''):
if context is None:
context = self.context
- return self.request.registry.queryMultiAdapter((context, self.request), IContentBannerIllustration,
+ return self.request.registry.queryMultiAdapter((context, self.request),
+ IContentBannerIllustration,
name=name)
@@ -128,7 +135,8 @@
def render(self, context=None, name=''):
if context is None:
context = self.context
- return self.request.registry.queryMultiAdapter((context, self.request), IContentHeaderIllustration,
+ return self.request.registry.queryMultiAdapter((context, self.request),
+ IContentHeaderIllustration,
name=name)
@@ -149,7 +157,8 @@
@adapter_config(context=IIllustration, provides=IIllustrationWithZoomSettings)
def illustration_with_zoom_settings_factory(context):
"""Illustration zoom renderer settings factory"""
- return get_annotation_adapter(context, ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY, IIllustrationWithZoomSettings)
+ return get_annotation_adapter(context, ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY,
+ IIllustrationWithZoomSettings)
#
@@ -166,7 +175,8 @@
position = None
-@adapter_config(name='centered-before-body', context=(IIllustration, IPyAMSLayer), provides=IContentRenderer)
+@adapter_config(name='centered-before-body', context=(IIllustration, IPyAMSLayer),
+ provides=IContentRenderer)
@template_config(template='templates/illustration-default.pt', layer=IPyAMSLayer)
class DefaultIllustrationRenderer(BaseIllustrationRenderer):
"""Default illustration renderer"""